记录详情

Wrong Answer

foo.c: In function 'main':
foo.c:14:5: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &T);
     ^~~~~~~~~~~~~~~
foo.c:16:9: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&n);
         ^~~~~~~~~~~~~~
foo.c:18:13: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d",&m1[j]);
             ^~~~~~~~~~~~~~~~~~
foo.c:21: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"] 3ms 256.0 KiB
#2 Wrong Answer Read {0}, expect {1}. ["418","209"] 19ms 288.0 KiB
#3 Wrong Answer Read {0}, expect {1}. ["219","73"] 142ms 388.0 KiB

代码



#include<stdio.h>
int MIN(int n,int m){
    if (n>m) {
        return n;
    }else return m;
    
}
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
                for (f=1; f<MIN(m1[k],m2[k]); 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-20 17:52:51
评测时间
2020-12-20 17:52:51
评测机
分数
0
总耗时
165ms
峰值内存
388.0 KiB