Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import <Foundation/Foundation.h>
- #import <stdio.h>
- int main( int argc, const char *argv[] ) {
- int T,Z,A,B;
- char string[17];
- BOOL odd = YES;
- scanf("%d",&T);
- NSMutableArray* array = [[NSMutableArray alloc]init];
- NSMutableArray* oddArray = [[NSMutableArray alloc]init];
- for ( int i = 1;i<=T;i++){
- scanf("%16s",string);
- for (int j = 0;j<=16;j++) {
- int X = string[j] - '0';
- [array insertObject:[NSNumber numberWithInteger:X] atIndex:j];
- }
- NSArray* reversedArray = [[array reverseObjectEnumerator] allObjects];
- for (int k = 0;k < [reversedArray count];k++) {
- int theNum = [[reversedArray objectAtIndex:k] integerValue];
- if (odd){
- A = A + theNum;
- } else {
- B += theNum/5 + (2*theNum) % 10;
- }
- odd = !odd;
- }
- int sum = A+B;
- printf("%d\n",sum);
- if(sum%10){
- printf("NO");
- } else {
- printf("YES");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement