标签:
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 13640 | Accepted: 7361 |
3
4 2
6 6
3 4
6
12
No Number
找规律
CODE:
#include <iostream> #include <cstdio> #include <cstring> #define REP(i, s, n) for(int i = s; i <= n; i ++) #define REP_(i, s, n) for(int i = n; i >= s; i --) using namespace std; int main(){ int T; scanf("%d", &T); while(T --){ int x, y; scanf("%d%d", &x, &y); if(x == y){ if(x % 2 == 1) printf("%d\n", x / 2 * 4 + 1); else printf("%d\n", x * 2); } else if(x - y == 2){ if(y % 2 == 1) printf("%d\n", (y / 2) * 4 + 3); else printf("%d\n", (y / 2) * 4 + 2); } else printf("No Number\n"); } return 0; }
标签:
原文地址:http://www.cnblogs.com/ALXPCUN/p/4543331.html