sicily 1790. Single Round Match
很简单一道题,高精度判断能否被11整除, WA了好几次,发现输入0 0 时原来要输出YES~
#include <iostream> #include <string.h> #define MAX 10000 using namespace std; char a[MAX]; char b[MAX]; int main() { int cases; cin >> cases; int size_a; while (cases--) { cin >> a >> b;; size_a = strlen(a); if (strcmp(a, b) != 0) cout << "NO" << endl; else { int n = a[0]-'0'; for (int i = 1; i < size_a; i++) n = (n*10+a[i]-'0')%11; if (n != 0) cout << "NO" << endl; else cout << "YES" << endl; } } return 0; }