标签:
Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1067 Accepted Submission(s): 691
#include <iostream> #include <stdio.h> #include <string.h> #include <stack> #include <vector> #include <algorithm> using namespace std; typedef long long LL; /*void init(int test) { int n = 1; for(int i=1; i<=test; i++) { n*=10; } int a[10],cnt=0; for(int i=1; i<=n; i++) { int m = i; int id = 1; while(m) { a[id++] = m%10; m/=10; } bool flag = true; for(int k=1,j=id-1; k<=j; k++,j--) { if(a[k]!=a[j]) { flag = false; break; } } if(flag) { id = id-1; flag = true; for(int k=2; k<=id/2; k++) { if(a[k]<=a[k-1]) flag = false; } if(id%2==1&&id!=1){ if(a[id/2]>=a[id/2+1]) flag = false; } if(flag) { printf("%d\n",i); cnt++; } } } printf("%d\n",cnt); }*/ int a[]={1,9,18,54,90,174,258}; int main() { /*int test; while(true){ scanf("%d",&test); init(test); }*/ int tcase; scanf("%d",&tcase); while(tcase--){ int n; scanf("%d",&n); printf("%d\n",a[n]); } return 0; }
标签:
原文地址:http://www.cnblogs.com/liyinggang/p/5656772.html