https://ac.nowcoder.com/acm/contest/342/A
题解:
/*
*@Author: STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
int t,n,m,k,q;
int ans,cnt,flag,temp;
int s[][2]={1,10,2,20,3,30,10,1,11,11,12,21};
struct node{
int y;
int m;
int d;
}a[N];
char str;
bool prime(int x){
if(x==1)
return 0;
int tmp=sqrt(x);
for(int i=2;i<=tmp;i++)
if(x%i==0)
return 0;
return 1;
}
int main()
{
#ifdef DEBUG
freopen("input.in", "r", stdin);
//freopen("output.out", "w", stdout);
#endif
//
for(int i=2000;i<=9999;i++){
if(prime(i))
for(int j=0;j<6;j++){
a[++cnt].y=i;
a[cnt].m=s[j][0];
a[cnt].d=s[j][1];
}
}
scanf("%d",&t);
while(t--){
scanf("%d",&n);
printf("%d-",a[n].y);
if(a[n].m<10)
printf("0");
printf("%d-",a[n].m);
if(a[n].d<10)
printf("0");
printf("%d\n",a[n].d);
}
//cout << "Hello world!" << endl;
return 0;
}