Data with an indefinite number of existing groups , Each group has two integers (int type ), If the first number is the mantissa of the second number , The output 1, Represents a match , Otherwise output 0.
input
Multiple lines , Two positive integers per line .
output
Multiple lines , One per line , perhaps 0, perhaps 1.
sample input
123 45123
122 122333
sample output
1
0
Refer to the answer 1:
#include <stdio.h>int main(){ int m,n; while(scanf("%d %d",&m,&n) != EOF) { while(m>0 && n>0) { if(m%10 != n%10) break; m = m/10; n = n/10; } if(m==0 && n>=0) printf("1\n"); else printf("0\n"); } return 0;}
Refer to the answer 2: