Advertisement
noshin98

uva 11743

Feb 5th, 2017
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. char a[5],b[5],c[5],d[5];
  6. int kase,i,j,k,x,y,z,val,sum1,sum2,sumt;
  7. while(scanf("%d\n",&kase)==1)
  8. {
  9. for(int count=1;count<=kase;count++)
  10. {
  11. scanf("%s %s %s %s",&a,&b,&c,&d);
  12. sum1=sum2=sumt=0;
  13. sum1+=((a[0]-48)*2)/10+((a[0]-48)*2)%10+((a[2]-48)*2)/10+((a[2]-48)*2)%10;
  14. sum1+=((b[0]-48)*2)/10+((b[0]-48)*2)%10+((b[2]-48)*2)/10+((b[2]-48)*2)%10;
  15. sum1+=((c[0]-48)*2)/10+((c[0]-48)*2)%10+((c[2]-48)*2)/10+((c[2]-48)*2)%10;
  16. sum1+=((d[0]-48)*2)/10+((d[0]-48)*2)%10+((d[2]-48)*2)/10+((d[2]-48)*2)%10;
  17. sum2=a[1]-48+a[3]-48+b[1]-48+b[3]-48+c[1]-48+c[3]-48+d[1]-48+d[3]-48;
  18. sumt=sum1+sum2;
  19. if(sumt%10==0)printf("Valid\n");
  20. else printf("Invalid\n");
  21. }
  22. }
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement