记录详情

Wrong Answer

foo.c: In function 'main':
foo.c:8:5: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &T);
     ^~~~~~~~~~~~~~~
foo.c:10:9: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&n);
         ^~~~~~~~~~~~~~
foo.c:12:13: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d",&m1[j]);
             ^~~~~~~~~~~~~~~~~~
foo.c:15:17: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
                 scanf("%d",&m2[k]);
                 ^~~~~~~~~~~~~~~~~~
# 状态 耗时 内存占用
#1 Wrong Answer Read {0}, expect {1}. ["292","146"] 2ms 340.0 KiB
#2 Wrong Answer Read {0}, expect {1}. ["418","209"] 11ms 724.0 KiB
#3 Wrong Answer Read {0}, expect {1}. ["219","73"] 106ms 4.211 MiB

代码



#include<stdio.h>
int main(){
    int T,n;
    int i=0,j=0,k=0,f=1;
    int m1[9999],m2[9999];
    scanf("%d", &T);
    for (i=0; i<T; i++) {//组数
        scanf("%d",&n);
        for (j=0; j<=n; j++) {
            scanf("%d",&m1[j]);
        }
        for (k=0; k<=n; k++) {
                scanf("%d",&m2[k]);
            }
        for (k=n; k>=0; k--) {
            if (m1[k]==0&&m2[k]!=0) {//上是0
                printf("0 1\n");
                break;
            }else if (m1[k]==0&&m2[k]==0){//都是0
                continue;
            }else if (m2[k]==0&&m1[k]!=0){//下是0
                printf("infty\n");
                break;
            }else if (m1[k]!=0&&m2[k]!=0){//都不0
                int min;
                if (m1[k]>m2[k]) {
                    min=m2[k];
                }else min=m1[k];
                for (f=1; f<min; f++) {
                    if (m1[k]%f==0&&m2[k]%f==0) {
                        m1[k]/=f;
                        m2[k]/=f;
                    }
                }
                printf("%d %d\n",m1[k],m2[k]);
                break;
            }
        }
        }
    
return 0;}

信息

递交者
类型
递交
题目
P1000 hitwh 2019 新生赛 A ∞
语言
C
递交时间
2020-12-21 20:18:24
评测时间
2020-12-21 20:18:24
评测机
分数
0
总耗时
119ms
峰值内存
4.211 MiB