- ganggang的烦恼
- 2015-08-14 09:57:38 @
为什么我的代码只对2个点。。。
编译成功
foo.cpp: In function 'long long int panduan(long long int)':
foo.cpp:9:9: warning: unused variable 's' [-Wunused-variable]
int s=0;
^
测试数据 #0: Accepted, time = 0 ms, mem = 516 KiB, score = 25
测试数据 #1: Accepted, time = 0 ms, mem = 516 KiB, score = 25
测试数据 #2: WrongAnswer, time = 0 ms, mem = 516 KiB, score = 0
测试数据 #3: WrongAnswer, time = 0 ms, mem = 516 KiB, score = 0
WrongAnswer, time = 0 ms, mem = 516 KiB, score = 50
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
long long panduan(long long x)
{
int s=0;
int t=int(sqrt(double(x+1)));
for(int i=2;i<=t;i++)
{
if(x%i==0)
{
return 0;
}
}
return 1;
}
int main()
{
long long i,ans=1,tot=0;
int n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
ans=ans*i;
}
while(ans>0)
{
tot=tot+ans%10;
ans=ans/10;
}
if(panduan(tot)==1)
{
printf("%I64dT\n",tot);
}
else
{
printf("%I64dF\n",tot);
}
return 0;
}
求解啊!!
3 条评论
-
Deny_小田 LV 8 @ 2016-06-19 16:30:12
顶。。
-
2015-08-14 10:04:35@
有木有不打表的方法啊
-
2015-08-14 09:59:12@
#include<cstdio>
char ans[1000 + 2][7] = { "1F" , "1F" , "2T" , "6F" , "6F" , "3T" , "9F" , "9F" , "9F" , "27F" , "27F" , "36F" , "27F" , "27F" , "45F" , "45F" , "63F" , "63F" , "54F" , "45F" , "54F" , "63F" , "72F" , "99F" , "81F" , "72F" , "81F" , "108F" , "90F" , "126F" , "117F" , "135F" , "108F" , "144F" , "144F" , "144F" , "171F" , "153F" , "108F" , "189F" , "189F" , "144F" , "189F" , "180F" , "216F" , "207F" , "216F" , "225F" , "234F" , "225F" , "216F" , "198F" , "279F" , "279F" , "261F" , "279F" , "333F" , "270F" , "288F" , "324F" , "288F" , "315F" , "306F" , "333F" , "324F" , "351F" , "351F" , "369F" , "342F" , "351F" , "459F" , "423F" , "432F" , "315F" , "378F" , "432F" , "441F" , "432F" , "423F" , "441F" , "450F" , "486F" , "477F" , "486F" , "477F" , "414F" , "495F" , "495F" , "531F" , "549F" , "585F" , "594F" , "540F" , "513F" , "549F" , "585F" , "648F" , "648F" , "639F" , "648F" , "648F" , "639F" , "630F" , "621F" , "702F" , "648F" , "639F" , "594F" , "666F" , "657F" , "657F" , "693F" , "765F" , "666F" , "648F" , "648F" , "729F" , "738F" , "756F" , "774F" , "783F" , "774F" , "738F" , "765F" , "747F" , "855F" , "801F" , "873F" , "828F" , "819F" , "864F" , "927F" , "873F" , "846F" , "846F" , "819F" , "864F" , "927F" , "954F" , "981F" , "954F" , "963F" , "1026F" , "936F" , "1017F" , "972F" , "1017F" , "954F" , "1008F" , "1107F" , "1053F" , "990F" , "990F" , "999F" , "1062F" , "1053F" , "1098F" , "1125F" , "1134F" , "1089F" , "1107F" , "1134F" , "1125F" , "1134F" , "1098F" , "1116F" , "1188F" , "1089F" , "1188F" , "1188F" , "1179F" , "1242F" , "1215F" , "1206F" , "1215F" , "1233F" , "1215F" , "1278F" , "1368F" , "1260F" , "1305F" , "1323F" , "1287F" , "1314F" , "1323F" , "1260F" , "1296F" , "1377F" , "1422F" , "1386F" , "1350F" , "1422F" , "1404F" , "1458F" , "1395F" , "1413F" , "1422F" , "1512F" , "1395F" , "1413F" , "1404F" , "1350F" , "1404F" , "1476F" , "1494F" , "1530F" , "1584F" , "1647F" , "1602F" , "1530F" , "1548F" , "1512F" , "1593F" , "1530F" , "1674F" , "1674F" , "1575F" , "1638F" , "1665F" , "1575F" , "1701F" , "1692F" , "1665F" , "1701F" , "1773F" , "1728F" , "1728F" , "1656F" , "1638F" , "1701F" , "1746F" , "1665F" , "1809F" , "1728F" , "1872F" , "1746F" , "1755F" , "1890F" , "1818F" , "1818F" , "1926F" , "1890F" , "1971F" , "1980F" , "1863F" , "1944F" , "1827F" , "1872F" , "1935F" , "1881F" , "1953F" , "1926F" , "1917F" , "2025F" , "1926F" , "1899F" , "1989F" , "1953F" , "1863F" , "1971F" , "1962F" , "2079F" , "2088F" , "2061F" , "1953F" , "2106F" , "2124F" , "2043F" , "2133F" , "2106F" , "2151F" , "2169F" , "2133F" , "1980F" , "2088F" , "2187F" , "2043F" , "2313F" , "2367F" , "2223F" , "2241F" , "2367F" , "2340F" , "2349F" , "2241F" , "2304F" , "2313F" , "2385F" , "2322F" , "2385F" , "2313F" , "2331F" , "2412F" , "2385F" , "2358F" , "2511F" , "2484F" , "2394F" , "2376F" , "2448F" , "2466F" , "2376F" , "2511F" , "2493F" , "2394F" , "2529F" , "2457F" , "2466F" , "2430F" , "2412F" , "2646F" , "2556F" , "2565F" , "2502F" , "2601F" , "2556F" , "2637F" , "2574F" , "2655F" , "2583F" , "2700F" , "2628F" , "2808F" , "2637F" , "2610F" , "2700F" , "2727F" , "2682F" , "2718F" , "2754F" , "2655F" , "2772F" , "2853F" , "2862F" , "2835F" , "2790F" , "2907F" , "2817F" , "2925F" , "2817F" , "2754F" , "2961F" , "2835F" , "2844F" , "2844F" , "2916F" , "2808F" , "2844F" , "2970F" , "2934F" , "2952F" , "2862F" , "3123F" , "2844F" , "2925F" , "3069F" , "2952F" , "2979F" , "2979F" , "3087F" , "3024F" , "2997F" , "3060F" , "3060F" , "3087F" , "3114F" , "3024F" , "3033F" , "3132F" , "3204F" , "3186F" , "3213F" , "3195F" , "3258F" , "3186F" , "3159F" , "3249F" , "3186F" , "3132F" , "3312F" , "3240F" , "3195F" , "3204F" , "3357F" , "3339F" , "3375F" , "3366F" , "3204F" , "3348F" , "3366F" , "3321F" , "3384F" , "3474F" , "3312F" , "3348F" , "3312F" , "3582F" , "3429F" , "3528F" , "3627F" , "3402F" , "3339F" , "3366F" , "3483F" , "3474F" , "3600F" , "3528F" , "3609F" , "3465F" , "3483F" , "3447F" , "3573F" , "3672F" , "3600F" , "3654F" , "3708F" , "3618F" , "3726F" , "3708F" , "3564F" , "3672F" , "3807F" , "3690F" , "3627F" , "3636F" , "3780F" , "3618F" , "3753F" , "3636F" , "3762F" , "3807F" , "3798F" , "3897F" , "3771F" , "3834F" , "3879F" , "3780F" , "3780F" , "4059F" , "3807F" , "3726F" , "3852F" , "3861F" , "3753F" , "4041F" , "3969F" , "3825F" , "3978F" , "4023F" , "4185F" , "3825F" , "3888F" , "4059F" , "4203F" , "4140F" , "4059F" , "4176F" , "4176F" , "4149F" , "3969F" , "4077F" , "4131F" , "4158F" , "4221F" , "4041F" , "4194F" , "4275F" , "4140F" , "4257F" , "4140F" , "4275F" , "4338F" , "4284F" , "4266F" , "4419F" , "4428F" , "4383F" , "4194F" , "4356F" , "4365F" , "4356F" , "4059F" , "4320F" , "4266F" , "4302F" , "4383F" , "4329F" , "4536F" , "4509F" , "4419F" , "4284F" , "4410F" , "4608F" , "4302F" , "4455F" , "4464F" , "4374F" , "4644F" , "4527F" , "4608F" , "4599F" , "4446F" , "4518F" , "4536F" , "4671F" , "4644F" , "4527F" , "4581F" , "4671F" , "4707F" , "4644F" , "4554F" , "4635F" , "4761F" , "4563F" , "4716F" , "4698F" , "4779F" , "4860F" , "4752F" , "4761F" , "4680F" , "4698F" , "4842F" , "4815F" , "4860F" , "4761F" , "4968F" , "4986F" , "4941F" , "4977F" , "4950F" , "4923F" , "4896F" , "4932F" , "4851F" , "4977F" , "4797F" , "4986F" , "4869F" , "5202F" , "5067F" , "5085F" , "4941F" , "4968F" , "5076F" , "5112F" , "5274F" , "5121F" , "4923F" , "5139F" , "4860F" , "5337F" , "4950F" , "5067F" , "5193F" , "5409F" , "5166F" , "5247F" , "5346F" , "5139F" , "5274F" , "5202F" , "5373F" , "5265F" , "5391F" , "5301F" , "5337F" , "5472F" , "5319F" , "5265F" , "5427F" , "5400F" , "5427F" , "5364F" , "5346F" , "5337F" , "5454F" , "5265F" , "5400F" , "5373F" , "5499F" , "5562F" , "5382F" , "5427F" , "5292F" , "5706F" , "5562F" , "5499F" , "5526F" , "5562F" , "5652F" , "5562F" , "5679F" , "5328F" , "5616F" , "5724F" , "5787F" , "5697F" , "5634F" , "5715F" , "5634F" , "5760F" , "5787F" , "5589F" , "5742F" , "5661F" , "5499F" , "5823F" , "5931F" , "5823F" , "5877F" , "5823F" , "5787F" , "5832F" , "5841F" , "5850F" , "5886F" , "5778F" , "5841F" , "5922F" , "6039F" , "5859F" , "6003F" , "5931F" , "5958F" , "6120F" , "5895F" , "5904F" , "5904F" , "6057F" , "6012F" , "5931F" , "5967F" , "6147F" , "5859F" , "5859F" , "6237F" , "6210F" , "6336F" , "6057F" , "6291F" , "6021F" , "6291F" , "6021F" , "6219F" , "6156F" , "6282F" , "6012F" , "6372F" , "6300F" , "6399F" , "6372F" , "6282F" , "6246F" , "6291F" , "6318F" , "6219F" , "6453F" , "6192F" , "6516F" , "6408F" , "6444F" , "6147F" , "6417F" , "6381F" , "6327F" , "6498F" , "6462F" , "6453F" , "6363F" , "6489F" , "6417F" , "6480F" , "6615F" , "6453F" , "6561F" , "6831F" , "6444F" , "6444F" , "6444F" , "6417F" , "6534F" , "6687F" , "6786F" , "6651F" , "6687F" , "6615F" , "6777F" , "6795F" , "6876F" , "6966F" , "6957F" , "6669F" , "6822F" , "6831F" , "6696F" , "6741F" , "6957F" , "6885F" , "6723F" , "6777F" , "6741F" , "6849F" , "6840F" , "6678F" , "6849F" , "6831F" , "6957F" , "7065F" , "7056F" , "7092F" , "6966F" , "6876F" , "7083F" , "6912F" , "7191F" , "7101F" , "7020F" , "7191F" , "7164F" , "6957F" , "7110F" , "7047F" , "7092F" , "6957F" , "7083F" , "7182F" , "7407F" , "7065F" , "7254F" , "7137F" , "7254F" , "7155F" , "7155F" , "7128F" , "7515F" , "7317F" , "7029F" , "7461F" , "7263F" , "7218F" , "7425F" , "7317F" , "7326F" , "7362F" , "7641F" , "7452F" , "7263F" , "7380F" , "7416F" , "7263F" , "7398F" , "7524F" , "7533F" , "7308F" , "7524F" , "7452F" , "7488F" , "7434F" , "7461F" , "7488F" , "7353F" , "7731F" , "7470F" , "7641F" , "7461F" , "7272F" , "7542F" , "7569F" , "7713F" , "7704F" , "7767F" , "7551F" , "7776F" , "7596F" , "7722F" , "7875F" , "7659F" , "7686F" , "7659F" , "7677F" , "7776F" , "7686F" , "7983F" , "7857F" , "7938F" , "8001F" , "7839F" , "7965F" , "7929F" , "8109F" , "7812F" , "7938F" , "8001F" , "8001F" , "8091F" , "8100F" , "7884F" , "8001F" , "7929F" , "7965F" , "7947F" , "8127F" , "7947F" , "7965F" , "7812F" , "8028F" , "8217F" , "8208F" , "8181F" , "8280F" , "8028F" , "8037F" , "8298F" , "8172F" , "8424F" , "8127F" , "8235F" , "8001F" , "8163F" , "8307F" , "8496F" , "8181F" , "8172F" , "8415F" , "8343F" , "8424F" , "8217F" , "8361F" , "8397F" , "8433F" , "8307F" , "8649F" , "8352F" , "8370F" , "8514F" , "8514F" , "8082F" , "8568F" , "8316F" , "8370F" , "8478F" , "8649F" , "8658F" , "8541F" , "8550F" , "8388F" , "8622F" , "8586F" , "8586F" , "8595F" , "8649F" , "8550F" , "8694F" , "8685F" , "8694F" , "8676F" , "8685F" , "8793F" , "8667F" , "8802F" , "8757F" , "8901F" , "8937F" , "8694F" , "8946F" , "8820F" , "8829F" , "9000F" , "9009F" , "9009F" , "8955F" , "8811F" , "8883F" , "8928F" , "8928F" , "8982F" , "8757F" , "8901F" , "9090F" , "8973F" , "9117F" , "8946F" , "8838F" , "9099F" , "9189F" , "9099F" , "9072F" , "8811F" , "9054F" , "9054F" , "8865F" , "9063F" , "9126F" , "9189F" , "9135F" , "9045F" , "9216F" , "9090F" , "9324F" , "9162F" , "9324F" , "9081F" , "9045F" , "9414F" , "9153F" , "9369F" , "9333F" , "9486F" , "9126F" , "9081F" , "9477F" , "9198F" , "9468F" , "9504F" , "9603F" , "9360F" , "9396F" , "9477F" , "9423F" , "9522F" , "9450F" , "9702F" , "9432F" , "9594F" , "9558F" , "9630F" , "9549F" , "9477F" , "9675F" , "9549F" , "9702F" , "9540F" , "9738F" , "9666F" , "9729F" , "9801F" , "9657F" , "9810F" , "9729F" , "9513F" , "9612F" , "9774F" , "9684F" , "9702F" , "9675F" , "9504F" , "9792F" , "9684F" , "9639F" , "10035F" , "9855F" , "9774F" , "9783F" , "9990F" , "9999F" , "9954F" , "9945F" , "9981F" , "9954F" , "9999F" , "9900F" , "10071F" , "10125F" , "10080F" , "9828F" , "10116F" , "10143F" , "10089F" , "10134F" , "9711F" , "10053F" , "10314F" , "10035F" , "10278F" , "9990F" , "10053F" , "10179F" , "10413F" , "10134F" , "10341F" , "10458F" , "9990F" , "10296F" , "10053F" , "10296F" , "10206F" , "10287F" , "10332F" , "10467F" , "10287F" , "10296F" , "10251F" , "10584F" , "10395F" , "10233F" , "10368F" , "10287F" , "10539F" , "10539F" };
int n;
int main()
{
scanf( "%d" , &n );
printf( "%s\n" , ans[n] );
return 0;
}
- 1