赞
踩
- #include<bits/stdc++.h>
- using namespace std;
- int a[105];
- int main()
- {
- int t,n;
- scanf("%d",&t);
- while(t--) {
- scanf("%d",&n);
- for(int i = 1;i <= n; ++i) scanf("%d",&a[i]);
- a[0] = a[1];
- int ans = 1;
- int loc = 0,lock = a[1];
- for(int i = 1;i <= n; ++i) {
- if(a[i] == lock)
- loc++;
- else {
- loc = 1;
- lock = a[i];
- }
- ans = max(ans,loc);
- }
- printf("%d\n",ans);
- }
- return 0;
- }
- #include<bits/stdc++.h>
- using namespace std;
- #define ll long long
- ll t,q,d;
-
- int main()
- {
- ll k;
- scanf("%lld",&t);
- while(t--) {
- scanf("%lld%lld",&q,&d);
- for(int i = 0;i < q; ++i) {
- scanf("%lld",&k);
- ll kk = k % 10;
- if(k >= d * 10LL) {
- puts("YES");
- }
- else {
- if(d == 1)
- puts("YES");
- else if(d == 2) {
- if(k % 2 == 0)
- puts("YES");
- else
- puts("NO");
- }
- else if(d == 3) {
- if(kk == 3 || kk == 6 || kk == 9 || (k >= 12 && kk == 2) || (k >= 15 && kk == 5) || (k >= 18 && kk == 8) || (k >= 21 && kk == 1) || (k >= 24 && kk == 4) || (k >= 27 && kk == 7) || (k >= 30 && kk == 0))
- puts("YES");
- else
- puts("NO");
- }
- else if(d == 4) {
- if(kk == 4 || kk == 8 || (k >= 12 && kk == 2)|| (k >= 16 && kk == 6) || (k >= 20 && kk == 0))
- puts("YES");
- else
- puts("NO");
- }
- else if(d == 5) {
- if(kk == 0 || kk == 5)
- puts("YES");
- else
- puts("NO");
- }
- else if(d == 6) {
- if(kk == 6 || (k >= 12 && kk == 2) || (k >= 18 && kk == 8) || (k >= 24 && kk == 4) || (k >= 30 && kk == 0))
- puts("YES");
- else
- puts("NO");
- }
- else if(d == 7) {
- if(kk == 7 || (k >= 14 && kk == 4) || (k >= 21 && kk == 1) || (k >= 28 && kk == 8) || (k >= 35 && kk == 5) || (k >= 42 && kk == 2) || (k >= 49 && kk == 9) || (k >= 56 && kk == 6) || (k >= 63 && kk == 3) || (k >= 70 && kk == 0))
- puts("YES");
- else
- puts("NO");
- }
- else if(d == 8) {
- if(kk == 8 || (k >= 16 && kk == 6) || (k >= 24 && kk == 4) || (k >= 32 && kk == 2) || (k >= 40 && kk == 0))
- puts("YES");
- else
- puts("NO");
- }
- else if(d == 9) {
- if(kk == 9 || (k >= 18 && kk == 8) || (k >= 27 && kk == 7) || (k >= 36 && kk == 6) || (k >= 45 && kk == 5) || (k >= 54 && kk == 4) || (k >= 63 && kk == 3) || (k >= 72 && kk == 2) || (k >= 81 && kk == 1) || (k >= 90 && kk == 0))
- puts("YES");
- else
- puts("NO");
- }
- }
- }
- }
-
- return 0;
- }
看到一个神奇的代码:
- main(q,d,x){for(scanf("%*d");~scanf("%d%d",&q,&d);)while(q--){
- scanf("%d",&x);while(x>d&&x<d*10&&x%d)x-=10;puts(x<d?"NO":"YES");}}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。