标签:des blog http io ar os sp for strong
Description
Input
Output
Sample Input
Sample Output
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<cstdlib> #include<queue> #include<vector> #include<algorithm> #include<string> using namespace std; int t,n,k,a[110]; bool flag; bool cmp(int x,int y) { return x<y; } int main() { scanf("%d",&t); while(t--) { flag=true; scanf("%d%d",&n,&k); for(int i=1;i<=n;i++) scanf("%d",&a[i]); sort(a+1,a+1+n,cmp); for(int i=1;i<=n;i++) { if(a[i]==i) continue; else if(a[i]>i) { flag=false; break; } else { a[i]+=k; sort(a+1,a+1+n,cmp); i--; } } if(flag) printf("Jerry\n"); else printf("Tom\n"); } return 0; }
标签:des blog http io ar os sp for strong
原文地址:http://www.cnblogs.com/a972290869/p/4109381.html