嗯,今天这个事情我觉得放在开头很好,今天我创建了两道题目。
一道非常简单的,我也只给了一组样例数据,非常的简单,希望你们来刷一下AC。
还有就是我们的团队,我们团队不是很壮大,有五六个人都是我的同学,你们如果感兴趣可以加一下群点击这个,我也在我们群里出了一道题,晒几张图吧!
这道题不太难的好吧,感觉还是可以的
我这个题也是在网络上看到了,就编了一个题目,写上去了,也希望你们来看看这道题!
好了言归正传,我们今天要给出的主题是,P2010回文日期。
其实这道题很简单,只不过有些人想不到,最简单的做法是啥啊?
打表
很多人不知道什么是打表,那个我给你们放一段我在其他题解里看到的代码。
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,m,k,x,y,o,p,ans=0;
int dx1[13]={2,0,-2,0,1,1,1,0,0,0,-1,-1,-1},
dy1[13]={0,2,0,-2,0,1,-1,1,0,-1,0,1,-1};
int dx2[25]={-2,-2,-2,-2,-2,-1,-1,-1,-1,-1,0,0,0,0,0,1,1,1,1,1,2,2,2,2,2},
dy2[25]={-2,-1,0,1,2,-2,-1,0,1,2,-2,-1,0,1,2,-2,-1,0,1,2,-2,-1,0,1,2};
int main()
{
cin>>n>>m>>k;
int a[n+5][n+5];
memset(a,0,sizeof(a));
for(int i=1;i<=m;i++)
{
cin>>x>>y;
for(int j=0;j<13;j++)
a[x+dx1[j]][y+dy1[j]]=1;
}
for(int i=1;i<=k;i++)
{
cin>>o>>p;
for(int j=0;j<25;j++)
a[o+dx2[j]][p+dy2[j]]=1;
}
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
if(a[i][j]==0)
ans++;
cout<<ans;
return 0;
}
这个还不是夸张的,我的才叫夸张
我们把所有的回文日期都写出来!!!
331个!!!
当然不会的同学可以这样写,毕竟考场上有三四个小时让你写,混个二等奖轻轻松松。
把我的331个回文日期晒出来。
int a[1000]={10011001,10100101,10111101,10200201,10211201,10300301,10400401,10500501,10600601,10700701,10800801,10900901,11011011,11100111,11111111,11200211,11211211,11300311,11400411,11500511,11600611,11700711,11800811,11900911,12011021,12100121,12111121,12200221,12211221,12300321,12400421,12500521,12600621,12700721,12800821,12900921,13011031,13100131,13211231,13300331,13500531,13700731,13800831,20011002,20100102,20111102,20200202,20211202,20300302,20400402,20500502,20600602,20700702,20800802,20900902,21011012,21100112,21111112,21200212,21211212,21300312,21400412,21500512,21600612,21700712,21800812,21900912,22011022,22100122,22111122,22200222,22211222,22300322,22400422,22500522,22600622,22700722,22800822,22900922,30011003,30100103,30111103,30200203,30211203,30300303,30400403,30500503,30600603,30700703,30800803,30900903,31011013,31100113,31111113,31200213,31211213,31300313,31400413,31500513,31600613,31700713,31800813,31900913,32011023,32100123,32111123,32200223,32211223,32300323,32400423,32500523,32600623,32700723,32800823,32900923,40011004,40100104,40111104,40200204,40211204,40300304,40400404,40500504,40600604,40700704,40800804,40900904,41011014,41100114,41111114,41200214,41211214,41300314,41400414,41500514,41600614,41700714,41800814,41900914,42011024,42100124,42111124,42200224,42211224,42300324,42400424,42500524,42600624,42700724,42800824,42900924,50011005,50100105,50111105,50200205,50211205,50300305,50400405,50500505,50600605,50700705,50800805,50900905,51011015,51100115,51111115,51200215,51211215,51300315,51400415,51500515,51600615,51700715,51800815,51900915,52011025,52100125,52111125,52200225,52211225,52300325,52400425,52500525,52600625,52700725,52800825,52900925,60011006,60100106,60111106,60200206,60211206,60300306,60400406,60500506,60600606,60700706,60800806,60900906,61011016,61100116,61111116,61200216,61211216,61300316,61400416,61500516,61600616,61700716,61800816,61900916,62011026,62100126,62111126,62200226,62211226,62300326,62400426,62500526,62600626,62700726,62800826,62900926,70011007,70100107,70111107,70200207,70211207,70300307,70400407,70500507,70600607,70700707,70800807,70900907,71011017,71100117,71111117,71200217,71211217,71300317,71400417,71500517,71600617,71700717,71800817,71900917,72011027,72100127,72111127,72200227,72211227,72300327,72400427,72500527,72600627,72700727,72800827,72900927,80011008,80100108,80111108,80200208,80211208,80300308,80400408,80500508,80600608,80700708,80800808,80900908,81011018,81100118,81111118,81200218,81211218,81300318,81400418,81500518,81600618,81700718,81800818,81900918,82011028,82100128,82111128,82200228,82211228,82300328,82400428,82500528,82600628,82700728,82800828,82900928,90011009,90100109,90111109,90200209,90211209,90300309,90400409,90500509,90600609,90700709,90800809,90900909,91011019,91100119,91111119,91200219,91211219,91300319,91400419,91500519,91600619,91700719,91800819,91900919,92011029,92100129,92111129,92200229,92211229,92300329,92400429,92500529,92600629,92700729,92800829,92900929};
不要误解我水了。
算了给你们吧全部代码都晒出来,手抄不易,建议你自己写,不要复制我的。
#include<iostream>
using namespace std;
int a[1000]={10011001,10100101,10111101,10200201,10211201,10300301,10400401,10500501,10600601,10700701,10800801,10900901,11011011,11100111,11111111,11200211,11211211,11300311,11400411,11500511,11600611,11700711,11800811,11900911,12011021,12100121,12111121,12200221,12211221,12300321,12400421,12500521,12600621,12700721,12800821,12900921,13011031,13100131,13211231,13300331,13500531,13700731,13800831,20011002,20100102,20111102,20200202,20211202,20300302,20400402,20500502,20600602,20700702,20800802,20900902,21011012,21100112,21111112,21200212,21211212,21300312,21400412,21500512,21600612,21700712,21800812,21900912,22011022,22100122,22111122,22200222,22211222,22300322,22400422,22500522,22600622,22700722,22800822,22900922,30011003,30100103,30111103,30200203,30211203,30300303,30400403,30500503,30600603,30700703,30800803,30900903,31011013,31100113,31111113,31200213,31211213,31300313,31400413,31500513,31600613,31700713,31800813,31900913,32011023,32100123,32111123,32200223,32211223,32300323,32400423,32500523,32600623,32700723,32800823,32900923,40011004,40100104,40111104,40200204,40211204,40300304,40400404,40500504,40600604,40700704,40800804,40900904,41011014,41100114,41111114,41200214,41211214,41300314,41400414,41500514,41600614,41700714,41800814,41900914,42011024,42100124,42111124,42200224,42211224,42300324,42400424,42500524,42600624,42700724,42800824,42900924,50011005,50100105,50111105,50200205,50211205,50300305,50400405,50500505,50600605,50700705,50800805,50900905,51011015,51100115,51111115,51200215,51211215,51300315,51400415,51500515,51600615,51700715,51800815,51900915,52011025,52100125,52111125,52200225,52211225,52300325,52400425,52500525,52600625,52700725,52800825,52900925,60011006,60100106,60111106,60200206,60211206,60300306,60400406,60500506,60600606,60700706,60800806,60900906,61011016,61100116,61111116,61200216,61211216,61300316,61400416,61500516,61600616,61700716,61800816,61900916,62011026,62100126,62111126,62200226,62211226,62300326,62400426,62500526,62600626,62700726,62800826,62900926,70011007,70100107,70111107,70200207,70211207,70300307,70400407,70500507,70600607,70700707,70800807,70900907,71011017,71100117,71111117,71200217,71211217,71300317,71400417,71500517,71600617,71700717,71800817,71900917,72011027,72100127,72111127,72200227,72211227,72300327,72400427,72500527,72600627,72700727,72800827,72900927,80011008,80100108,80111108,80200208,80211208,80300308,80400408,80500508,80600608,80700708,80800808,80900908,81011018,81100118,81111118,81200218,81211218,81300318,81400418,81500518,81600618,81700718,81800818,81900918,82011028,82100128,82111128,82200228,82211228,82300328,82400428,82500528,82600628,82700728,82800828,82900928,90011009,90100109,90111109,90200209,90211209,90300309,90400409,90500509,90600609,90700709,90800809,90900909,91011019,91100119,91111119,91200219,91211219,91300319,91400419,91500519,91600619,91700719,91800819,91900919,92011029,92100129,92111129,92200229,92211229,92300329,92400429,92500529,92600629,92700729,92800829,92900929};
int main(){
int x,y,cnt=0;
cin>>x>>y;
for(int i=0;i<331;i++){
if(x<=a[i]&&a[i]<=y) cnt++;
}
cout<<cnt;
return 0;
}
好的到这里有的同学可能会说,唉我们可以直接用程序输出回文日期再直接复制呀,这样就不用手抄了。
要不这样吧,我们把这个留成作业,评论区告诉我答案哟。
期待你的关注,再见!。