Educational Codeforces Round 5 A

时间:2022-11-20 14:34:47

Problem A:http://codeforces.com/contest/616/problem/A

A. Comparing Two Long Integers

果然还是我太天真了(长整数比较不就是long long么........于是一直wa on 9,直到今天起床看了看别人的代码才恍然大悟。。。

#include<stdio.h>
#include<string.h>
const int MAX_N = ; int main(){
char a[MAX_N],b[MAX_N];
int lena,lenb,la,lb,pa=,pb=,i;
scanf("%s%s",a,b);
lena=strlen(a);
lenb=strlen(b);
while(pa<lena&&a[pa]=='') pa++;
while(pb<lenb&&b[pb]=='') pb++;
la=lena-pa;
lb=lenb-pb;
if(la>lb)
printf(">\n");
else if(la<lb)
printf("<\n");
else{
for(i=pa;i<lena;i++){
if(a[i]>b[i-pa+pb]){
printf(">\n");
return ;
}
else if(a[i]<b[i-pa+pb]){
printf("<\n");
return ;
}
}
printf("=\n");
}
return ;
}