- 31、到底是不是太胖了
- 32、Left-pad
- 33、出生年
- 34、点赞
- 35、情人节
- 36、A乘以B
- 37、A除以B
- 38、新世界
- 39、古风排版
- 40、最佳情侣身高差
- 41、寻找250
- 42、日期格式化
- 43、阅览室
- 44、稳赢
- 45、宇宙无敌打招呼
- 46、整除光棍
- 47、装睡
- 48、矩阵A乘以B
- 49、天梯赛座位分配
- 50、倒数第N个字符串
- 51、打折
- 52、2018我们要赢
- 53、电子汪
- 54、福到了
- 55、谁是赢家
- 56、猜数字
- 57、PTA使我精神焕发
- 58、6翻了
- 59、敲笨钟
- 60、心理阴影面积
- 61、新胖子公式
- 62、幸运彩票
- 63、吃鱼还是吃肉
- 64、估值一亿的AI核心代码
- 65、甭废话上代码
- 66、猫是液体
- 67、洛希极限
- 68、调和平均
- 69、胎压监测
- 70、吃火锅
- 71、前世档案
- 72、刮刮彩票
- 73、人与神
- 74、两小时学完C语言
- 75、强迫症
- 76、降价提醒机器人
- 77、大笨钟的心情
- 78、吉老师的回归
- 79、天梯赛的善良
- 80、乘法口诀数列
- 81、今天我要赢
- 82、种钻石
- 83、谁能进图书馆
- 84、拯救外星人
- 85、试试手气
- 86、斯德哥尔摩火车上的题
- 87、机工士姆斯塔迪奥
- 88、静静的推荐
// 时间:2022.04.13 22点48分 #include32、Left-pad#include using namespace std; int m; void check(int h,float w) { //计算标准体重 float ww=(h-100)*0.9; //| 真实体重 − 标准体重 | < 标准体重×10% if(abs(ww-w)<(ww*0.1)){ cout<<"You are wan mei!"< =(ww*0.1)){ cout<<"You are tai pang le!"< =(ww*0.1)){ cout<<"You are tai shou le!"< cin>>m; while(m--) { int h,w;//h代表身高,w代表体重 cin>>h>>w; check(h,w/2.0); } return 0; }
// 时间:2022.04.13 23点27分 #include#include using namespace std; int n; char c; string str; int main () { //cin>>n>>c; scanf("%d %c",&n,&c); getchar();//www,没加这个导致一直无法读入字符串,需要用这个来吸收之前的换行符 getline(cin,str); //cout<<"n:"< cout< for(int i=str.size()-n;i str.size())//需要进行填充 { for(int i=1;i<=(n-str.size());i++) cout< 33、出生年 // 时间:2022.04.14 20点23分 #include34、点赞#include #include using namespace std; int main () { int y,n; cin>>y>>n; int ans=0; set ms; for(int i=y;i<3020;i++)//注意此处的范围,不能到3000就截至,因为y有可能取到3000 // 当n等于2 结果为0 3000 当n等于3 结果为1 3001 当n等于4 结果为12 3012 //所以这里的循环必须大于等于3012,只取3000测试点2扣一分 { ms.clear(); int num=i; for(int j=0;j<4;j++) { ms.insert(num%10);//以此从个位往高位添加,且还可以自动加0 num/=10; } if(ms.size()==n){ printf("%d %04dn",ans,i); break;} ans++; } return 0; } // 时间:2022.04.15 21点59分 #include#include #include using namespace std; int n; vector mv; bool bv[1010];//用来判断重复 int main () { cin>>n; for(int i=1;i<=n;i++) { int k=0,ret=0; cin>>k; for(int j=1;j<=k;j++){ cin>>ret; mv.push_back(ret); } } // sort(mv.begin(),mv.end());//将所有的数进行一个排序,然后从后面 int mmax=-1,ans=0;//mmax代表出现的次数,ans代表那个数 for(int i=mv.size()-1;i>=0;i--) { int sum=0; if(bv[mv[i]]==0){//之前没有碰到过才进行查找 for(int q=0;q mmax) { ans=mv[i]; mmax=sum; } bv[mv[i]]=1; } } cout< 35、情人节 // 时间:2022.04.15 22点24分 #include#include #include using namespace std; vector mv; int main () { string str; while(1){ str.clear(); cin>>str; if(str[0]=='.') break; mv.push_back(str); } if(mv.size()>=14){//存在A和B cout< =2 && mv.size()<13){//只有A没有B cout< //连A都没有 cout<<"Momo... No one is for you ..."< 36、A乘以B // 时间:2022.04.15 22点26分 #includeusing namespace std; int main () { int a,b; cin>>a>>b; cout< 37、A除以B // 时间:2022.04.15 22点39分 #include38、新世界using namespace std; int main () { int a,b; cin>>a>>b; if(b==0) printf("%d/0=Errorn",a); if(b>0) printf("%d/%d=%.2fn",a,b,a/(b*1.0)); if(b<0) printf("%d/(%d)=%.2fn",a,b,a/(b*1.0)); return 0; } // 时间:2022.04.15 22点41分 #include39、古风排版int main () { printf("Hello WorldnHello New Worldn"); return 0; } // 时间:2022.05.17 20点57分 #include#include #include using namespace std; int main () { int n,col;//col记录列数 cin>>n; getchar(); string str; getline(cin,str); //1、计算列数 if(str.size()%n==0) col=str.size()/n; else{ col=str.size()/n+1; //补余数个空格 for(int i=0;i string temp; for(int j=i*n;j for(int j=col-1;j>=0;j--) cout< 40、最佳情侣身高差 // 时间:2022.05.17 21点04分 #include41、寻找250using namespace std; int main () { int n; cin>>n; while(n--) { char op[2]; float h; cin>>op>>h; //cout< //查询的是女生 printf("%.2fn",h*1.09); } else if(*op=='M'){//查询的是男生 printf("%.2fn",h/1.09); } } return 0; } // 时间:2022.05.17 21点20分 #includeusing namespace std; int main () { int n; int i=1; while(cin>>n){ if(n==250) break; i++; } cout< 42、日期格式化 // 时间:2022.05.17 21点29分 #include43、阅览室using namespace std; int main () { int yy,mm,dd; scanf("%d-%d-%d",&mm,&dd,&yy); printf("%d-%02d-%02dn",yy,mm,dd);//唯一需要注意的地方是这里的需要补0 return 0; } // 阅览室 20分 #include44、稳赢// 每条数据记录该有的信息 typedef struct Book { int wasBorrow; char operate; int hour; int min; }Book; int main (void) { int days, count, times, id; id = days = count = times = 0; // 存储每本书的借还情况 Book records[1005], temp; scanf("%d", &days); while (days--) { while (1) { scanf("%d %c %d:%d", &id, &temp.operate, &temp.hour, &temp.min); if (0 == id) break; // 读取的操作如果是归还的话 else if ('E' == temp.operate) { if (records[id].wasBorrow == 1) { count++; times += (temp.hour - records[id].hour) * 60 + temp.min - records[id].min; records[id].wasBorrow = 0; } } // 读取的操作如果是借阅的话 else if ('S' == temp.operate) { records[id] = temp; records[id].wasBorrow = 1; } } // 当天数据处理完之后输出结果 if (0 == count) printf("0 0n"); else printf("%d %dn", count, (int)((double)times/count+0.5)); // 初始化一些该初始化的值 count = times = 0; for (int i = 0; i < 1005; i++) records[i].wasBorrow = 0; } return 0; } //时间:2022.05.17 23点45分 #include#include using namespace std; int main () { string str; int n; cin>>n; while(1) { for(int i=1;i<=n+1;i++){//以n=1为周期循环 cin>>str; if(str=="End") return 0; if(i==n+1){ cout< 45、宇宙无敌打招呼 // #include#include using namespace std; int main () { string str; cin>>str; cout<<"Hello "< 46、整除光棍 // 时间:2022.05.20 17点10分 #include47、装睡#include #include using namespace std; int arr[10]; int main () { int x; cin>>x; //第一种会超时 // string str; // for(int i=1;;i++){//每次加一位1 // str+='1'; // stringstream ss; // ss< >ret; // if(ret%x==0){ // cout< s=s*10+1; n++;//位数加一 } while (1) { // 开始进行除法运算 printf("%d", s / x); // 输出商, 从最高位一直输出到个位,因为最后一定能整除 s %= x; // 被除数更新为余数 if (s == 0) break; // 余数为0则结束 s = s * 10 + 1; // 余数末位添1 ++n; // 位数增1 } printf(" %dn", n); return 0; } // 时间:2022.05.18 09点28分 #includeusing namespace std; int main () { int n; cin>>n; while(n--){ string id; int h,m; //15~20 50~70 cin>>id>>h>>m; //cout< 20)//呼吸不在范围 ||(m<50||m>70)//脉搏不在范围 ||((h<15||h>20)&&(m<50||m>70))//两个都不在范围 ) cout< 48、矩阵A乘以B // 时间:2022.05.19 21点36分 #includeusing namespace std; int a[101][101];//矩阵A int b[101][101];//矩阵B int c[101][101];//A和B相乘的结果矩阵 int main () { int x,y;//A矩阵的行数和列数 int i,j; cin>>x>>y; for(i=1;i<=x;i++) for(j=1;j<=y;j++) cin>>a[i][j]; int x2,y2;//B矩阵的行数和列数 cin>>x2>>y2; for(i=1;i<=x2;i++) for(j=1;j<=y2;j++) cin>>b[i][j]; if(y!=x2){//如果不匹配 printf("Error: %d != %d",y,x2); return 0; } for(i=1;i<=x;i++) for(j=1;j<=y2;j++) { int sum=0; for(int k=1;k<=y;k++) sum+=a[i][k]*b[k][j]; c[i][j]=sum; } cout< for(j=1;j<=y2;j++){ if(j==y2){//每一行最后一个 cout< 49、天梯赛座位分配 // 时间;2022.05.21 22点17分 // 思路:以学校为行,每个学校学生人数为列,给每个学生进行编号 // 学校1:1 4 7 10 13 16 19 22 25 28 。。。 // 学校2:2 5 8 11 14 17 20 23 26 29 。。。 // 学校3:3 6 9 12 15 18 21 24 27 30.。。 #includeusing namespace std; struct School { int num;//队伍数 int arr[1010];//队员数目 }; int main () { int n,i,j; cin>>n;//n个学校 School sc[101];//最多100个学校 for(i=1;i<=n;i++) cin>>sc[i].num;//第i个学校的队伍数 //找出每个学校的队员数最大值 int mmax=sc[1].num*10; for(j=2;j<=n;j++) if(sc[j].num>sc[1].num) mmax=sc[j].num*10; //进行编号 int ans=1;//编号 for(i=1;i<=mmax;i++){ for(j=1;j<=n;j++){ //如果第j个学校的队伍队员已经排完了,则跳过这个学校 if(sc[j].num*10 ans++; sc[j].arr[i]++; } } } for(i=1;i<=n;i++){ printf("#%dn",i); for(j=1;j<=sc[i].num*10;j++){ cout< 50、倒数第N个字符串 // 时间:2022.05.15 21点37分 // 这个题很简单,将字符串类别成26进制的数就行 #include#include using namespace std; int main () { int l,n; cin>>l>>n; //l位的字符串的序列总数为pow(26,l),倒数N,则正向数为pow(26,l)-N //将正数的数以26进制写出来 int ret=pow(26,l)-n; char a[7];//最多六个字符 for(int i=l-1;i>=0;i--){ a[i]='a'+ret%26; ret/=26; } for(int i=0;i 51、打折 // 时间:2022.05.21 22点41分 #include52、2018我们要赢using namespace std; int main () { int a,b; cin>>a>>b; printf("%.2fn",a*(b*1.0/10)); return 0; } // 时间:2022.05.21 22点43分 #includeusing namespace std; int main () { cout<<"2018"< 53、电子汪 // 时间:2022.05.21 22点45分 #includeusing namespace std; int main () { int a,b; cin>>a>>b; int c=a+b; while(c--){ cout<<"Wang!"; } cout< 54、福到了 // 时间:2022.05.25 22点31分 #includeusing namespace std; char arr[101][101];//输入的字符数组 char brr[101][101];//输出的字符数组 int main () { int n; char c; cin>>c>>n; getchar();//吸收掉第一行行末的回车 for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++) scanf("%c",&arr[i][j]); getchar();//吸收掉每一行行末的回车 } for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++) if(arr[n-i+1][n-j+1]==' ')//唯一需要推导的关系 brr[i][j]=' '; else brr[i][j]=c; } //先判断倒过去是不是一样的 int flag=0; for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) if((arr[i][j]==' '&&brr[i][j]!=' ')||(arr[i][j]!=' '&&brr[i][j]==' ')) { flag=1; break; } if(flag==0) cout<<"bu yong dao le"< for(int j=1;j<=n;j++) cout< 55、谁是赢家 // 时间:2022.05.25 22点42分 #include56、猜数字using namespace std; int main () { int pa,pb,t; int arr[2]={0}; cin>>pa>>pb; for(int i=1;i<=3;i++){ cin>>t; arr[t]++; } //a赢的情况 if(pa>pb){ if(arr[0]>=1) printf("The winner is a: %d + %dn",pa,arr[0]); } else if(arr[0]==3) printf("The winner is a: %d + 3n",pa); //b赢的情况 if(pb>pa){ if(arr[1]>=1) printf("The winner is b: %d + %dn",pb,arr[1]); } else if(arr[1]==3) printf("The winner is b: %d + 3n",pb); return 0; } // 时间:2022.05.25 23点12分 #include#include #include using namespace std; int main () { int n; vector >mv; cin>>n; string str; int t; for(int i=1;i<=n;i++){ cin>>str>>t; mv.push_back(make_pair(str,t)); } int sum=0;//计算平均数的一半 for(int i=0;i ret=i; ans=abs(mv[i].second-sum); } cout< 57、PTA使我精神焕发 // 时间:2022.05.25 23点15分 #includeusing namespace std; int main () { cout<<"PTA shi3 wo3 jing1 shen2 huan4 fa1 !"< 58、6翻了 // 时间:2022.05.26 22点07分 #include59、敲笨钟#include using namespace std; int main () { string str; getline(cin,str); int i=0,cnt=0; int l=str.size(); while(i if(str[i]!='6')//不是6则直接输出 cout< for(cnt=0;i 9) cout<<27; else if(cnt>3) cout<<9;//连续的6的个数大于3但是没超过9个 else while(cnt-->0)cout<<6;//没超过3个则输出cnt个6即可 } } return 0; } // 时间:2022.05.26 23点08分 #include#include #include using namespace std; int main () { int n,i,j; cin>>n; string arr[21];//字符串数组 getchar(); for(i=0;i //遍历每一个字符串 int flag=0; for(j=0;j //找到逗号并且判断是否以ong结尾 if(arr[i][j]==','&&arr[i][j-1]=='g'&&arr[i][j-2]=='n'&&arr[i][j-3]=='o') flag++; //找到句号并且判断是否以ong结尾 if(arr[i][j]=='.'&&arr[i][j-1]=='g'&&arr[i][j-2]=='n'&&arr[i][j-3]=='o') flag++; } if(flag<2){//不押韵 cout<<"Skipped"< 0;j--){ if(arr[i][j]==' ') cnt++; if(cnt==3) break;//此时j的位置就是倒数第三个空格的位置 } for(int k=0;k<=j;k++) cout< 60、心理阴影面积 // 时间:2022.05.26 23点24分 #includeusing namespace std; int main () { int x,y; cin>>x>>y; //心理阴影的面积等于正方形的一半减去两个三角形的面积 cout<<5000-(100*y)/2-(100*(100-x))/2< 61、新胖子公式 // 时间:2022.05.26 23点17分 #include#include using namespace std; int main () { float hh,ww; cin>>ww>>hh; float ret=ww/(pow(hh,2)); printf("%.1fn",ret); if(ret>25) cout<<"PANG"< 62、幸运彩票 // 时间:2022.05.26 23点28分 #include#include using namespace std; int main () { int n; cin>>n; while(n--){ string str; cin>>str; if(str[0]+str[1]+str[2]==str[3]+str[4]+str[5]) cout<<"You are lucky!"< 63、吃鱼还是吃肉 // 时间:2022.05.27 23点07分 #includeusing namespace std; int main () { int n,ss,hh,ww; cin>>n; while(n--){ cin>>ss>>hh>>ww; if(ss==0){//女生的情况 if(hh<129) cout<<"duo chi yu! "; if(hh>129) cout<<"ni li hai! "; if(hh==129) cout<<"wan mei! "; if(ww<25) cout<<"duo chi rou!"< 25) cout<<"shao chi rou!"< //男生情况 if(hh<130) cout<<"duo chi yu! "; if(hh>130) cout<<"ni li hai! "; if(hh==130) cout<<"wan mei! "; if(ww<27) cout<<"duo chi rou!"< 27) cout<<"shao chi rou!"< 64、估值一亿的AI核心代码 // 时间:2022.06.08 15点52分 // 自己写只能得15分,太fw了 //原文链接:https://blog.csdn.net/weixin_61096287/article/details/124112923 #include#include using namespace std; string a,b; int main() { int n; cin>>n; getchar(); while(n--){ getline(cin,a); int l=a.length(); cout< if(a[i]>='A'&&a[i]<='Z'&&a[i]!='I') a[i]+=32; if(a[i]=='?') a[i]='!'; i++; } //句中空格第一次处理 i=0; while(i if(a[i]==' '){ if(!(a[i+1]>='0'&&a[i+1]<='9')&&a[i+1]!='I'&&(a[i+1]<'a'||a[i+1]>'z')) a.erase(i,1);//删除标点前的空格 while(a[i+1]==' ') a.erase(i+1,1);//删除多余的空格 } i++; } //句末空格 i=a.length()-1; while(a[i]==' '&&i){ a.erase(i,1); i--; } //句中空格第二次处理 i=0; l=a.length(); while(i if(a[i]==' '){ if(((a[i-1]>='0'&&a[i-1]<='9')||a[i-1]=='I'||a[i-1]>='a'&&a[i-1]<='z')&&(!(a[i+1]>='0'&&a[i+1]<='9')&&a[i+1]!='I'&&(a[i+1]<'a'||a[i+1]>'z'))) a.erase(i,1);//删除数字(单词)与标点之间的空格 } i++; } //测试 // cout< if((!(a[i-1]>='0'&&a[i-1]<='9')&&a[i-1]!='I'&&(a[i-1]<'a'||a[i-1]>'z'))){ //判断a[i-1]是否独立,下面的同理 if(a[i]=='c'&&a[i+1]=='a'&&a[i+2]=='n'&&a[i+3]==' '&&a[i+4]=='y'&&a[i+5]=='o'&&a[i+6]=='u'&&(!(a[i+7]>='0'&&a[i+7]<='9')&&a[i+7]!='I'&&(a[i+7]<'a'||a[i+7]>'z'))){ b+="I can"; i+=7; } else if(a[i]=='c'&&a[i+1]=='o'&&a[i+2]=='u'&&a[i+3]=='l'&&a[i+4]=='d'&&a[i+5]==' '&&a[i+6]=='y'&&a[i+7]=='o'&&a[i+8]=='u'&&a[i+9]!='I'&&(!(a[i+9]>='0'&&a[i+9]<='9')&&(a[i+9]<'a'||a[i+9]>'z'))){ b+="I could"; i+=9; } else if(a[i]=='I'&&(!(a[i+1]>='0'&&a[i+1]<='9')&&a[i+1]!='I'&&a[i+1]!='I'&&(a[i+1]<'a'||a[i+1]>'z'))){ b+="you"; i++; } else if(a[i]=='m'&&a[i+1]=='e'&&(!(a[i+2]>='0'&&a[i+2]<='9')&&a[i+2]!='I'&&(a[i+2]<'a'||a[i+2]>'z'))){ b+="you"; i+=2; } //其他情况 else{ b+=a[i]; i++; } } else{ b+=a[i]; i++; } } cout<<"AI: "< 65、甭废话上代码 // 时间:2022.05.27 23点10分 #includeusing namespace std; int main () { cout<<"Talk is cheap. Show me the code."< 66、猫是液体 // 时间:2022.05.27 23点21分 #includeusing namespace std; int main () { int cc,kk,gg; cin>>cc>>kk>>gg; cout< 67、洛希极限 // 时间:2022.05.27 23点50分 #includeusing namespace std; int main () { float a,b,d; int c; cin>>a>>c>>b; if(c==0)//流体 d=a*2.455; else if(c==1)//刚体 d=a*1.26; printf("%.2f ",d); if(b d)//会撕裂 cout<<"^_^"< 68、调和平均 // 时间:2022.05.27 23点54分 #include69、胎压监测using namespace std; int main () { int n; float ans; cin>>n; for(int i=1;i<=n;i++){ float ret; cin>>ret; ans=ans+1.0/ret; } printf("%.2fn",1/(ans/n)); return 0; } // 时间:2022.05.29 22点53分 #include#include using namespace std; int main () { int t1,t2,t3,t4,mmin,ret; cin>>t1>>t2>>t3>>t4>>mmin>>ret; //第一种情况,不报警 int mmax;//四个胎压中的最大值 mmax=max(t1,t2); mmax=max(mmax,t3); mmax=max(mmax,t4); if(t1>=mmin&&t2>=mmin&&t3>=mmin&&t4>=mmin &&(mmax-t1<=ret)&&(mmax-t2<=ret)&&(mmax-t3<=ret)&&(mmax-t4<=ret)){ cout<<"Normal"< ret||t1 =mmin&&t3>=mmin&&t4>=mmin &&(mmax-t2<=ret)&&(mmax-t3<=ret)&&(mmax-t4<=ret)){ printf("Warning: please check #%d!",1); return 0;} //t2 if((mmax-t2>ret||t2 =mmin&&t3>=mmin&&t4>=mmin &&(mmax-t1<=ret)&&(mmax-t3<=ret)&&(mmax-t4<=ret)){ printf("Warning: please check #%d!",2); return 0;} //t3 if((mmax-t3>ret||t3 =mmin&&t2>=mmin&&t4>=mmin &&(mmax-t1<=ret)&&(mmax-t2<=ret)&&(mmax-t4<=ret)){ printf("Warning: please check #%d!",3); return 0;} //t4 if((mmax-t4>ret||t4 =mmin&&t2>=mmin&&t3>=mmin &&(mmax-t1<=ret)&&(mmax-t2<=ret)&&(mmax-t3<=ret)){ printf("Warning: please check #%d!",4); return 0;} //剩下的情况:存在两个或者两个以上出现问题 cout<<"Warning: please check all the tires!"< 70、吃火锅 // 时间:2022.05.30 19点59分 //每一条信息接收一次,因为可能存在空格,因此不能使用scanf()函数接收,应使用gets()函数 //每一条信息只判断是否存在字串,不需要判断存在几个字串 (测试点 2) //单独的 . 是结束标志,但可能存在 . 开头的信息,此时没有结束,仍需进行判断,并继续接收下一条信息 (测试点 3) #include#include #include using namespace std; int main () { string str; int i=0,j=0,k=0;//i~朋友信息条数 j~第一次出现的编号 k~出现信息的总条数 while(1){ getline(cin,str); //下面这条语句一定要小心,单独的.是结束标志, //但是字符串以.开始是被允许的,导致我第一次测试点3没过 if(str[0]=='.'&&str.size()==1)//如果结束则退出 break; i++;//朋友信息条数加一 //查找这个字符串中是否含有吃火锅 int ret=str.find("chi1 huo3 guo1"); if(ret!=-1){//如果找到了 if(j==0)//如果是第一次找到,则需要用j记录一下 j=i; k++; } } cout< 71、前世档案 // 时间:2022.05.30 20点24分 //看作二进制,y为0,n为1,二进制转十进制 #include#include using namespace std; int main () { int n,m; string str; cin>>n>>m; while(m--){ cin>>str; int num=0; int ret=1; //y看成0,n看成1 for(int i=str.size()-1;i>=0;i--) { if(str[i]=='n')//如果这一位是’1‘ num=num+1*ret; ret*=2;//二进制进位 } cout< 72、刮刮彩票 // 时间:2022.05.30 21点19分 #includeusing namespace std; int a[4][4]; int book[10]={0};//标记数组,用来找到九宫格中0那个位置上的数字 int b[20]={10000,36,720,360,80,252,108,72,54,180,72,180,119,36,306,1080,144,1800,3600}; int main () { int i,j,x,y,ret; for(i=1;i<=3;i++) for(j=1;j<=3;j++){ cin>>a[i][j]; book[a[i][j]]++;//标记这个数字已经出现了 if(a[i][j]==0) {x=i,y=j;}//记录一下0的坐标 } //将0的位置填充上缺失的数 for( i=1;i<=9;i++) if(book[i]==0)//i在九宫格没出现过 a[x][y]=i; for(i=1;i<=3;i++){ cin>>x>>y; cout<>ret; int num=0; if(ret>=1&&ret<=3)//选择行 for(i=1;i<=3;i++) num+=a[ret][i]; else if(ret>=4&&ret<=6)//选择列 注意此时ret需要减3 for(i=1;i<=3;i++) num+=a[i][ret-3]; else if(ret==7) num=a[1][1]+a[2][2]+a[3][3]; else if(ret==8) num=a[1][3]+a[2][2]+a[3][1]; cout< 73、人与神 // 时间:2022.05.28 22点54分 #includeusing namespace std; int main () { cout<<"To iterate is human, to recurse divine."< 74、两小时学完C语言 // 时间:2022.05.28 23点27分 #includeusing namespace std; int main () { int a,b,c; cin>>a>>b>>c; cout< 75、强迫症 // 时间:2022.05.28 23点49分 #includeusing namespace std; int main() { string str; cin>>str; if(str.size()==4){ if(str[0]>'2'||(str[0]=='2'&&str[1]>='2'))//大于22 cout<<"19"< cout< 76、降价提醒机器人 // 时间:2022.05.28 23点57分 #includeusing namespace std; int main () { int n,ret; cin>>n>>ret; while(n--){ float t; cin>>t; if(t 77、大笨钟的心情 // 时间:2022.05.29 00点16分 #includeusing namespace std; int main () { int arr[25]; for(int i=0;i<24;i++) cin>>arr[i]; while(1){ int ret; cin>>ret; // cout< 23) break; if(arr[ret]>50) cout< 78、吉老师的回归 // 时间:2022.05.30 21点59分 #include#include #include using namespace std; int main () { int n,m; int j=0;//记录做完了几道题 cin>>n>>m; string a[31]; getchar(); for(int i=1;i<=n;i++){ getline(cin,a[i]); //如果发现了简单题,则进行跳过 if((a[i].find("qiandao")!=-1)||(a[i].find("easy")!=-1)) continue; //先判断是否满足做完了m道题 如果满足那么此时输入的题就是正在做的题 if(j==m){ cout< 79、天梯赛的善良 // 时间:2022.05.29 23点03分 #include80、乘法口诀数列using namespace std; int a[1000010]; int main () { int n,ret,mmin,mmax; cin>>n; cin>>ret; a[ret]++; mmin=ret,mmax=ret; for(int i=1;i<=n-1;i++) { cin>>ret; a[ret]++; if(ret mmax) mmax=ret; } printf("%d %dn",mmin,a[mmin]); printf("%d %dn",mmax,a[mmax]); return 0; } // 时间:2022.05.30 12点45分 #include#include using namespace std; int main () { vector mv; int a1,a2,n,ret; int l=0,r=1;//l,r表示当前乘的因子下标 cin>>a1>>a2>>n; mv.push_back(a1); mv.push_back(a2); //n=1和n=2的情况需要特判 刚开始没想到hhh,一定要注意数据范围 if(n==1){ cout< cout< ret=mv[l++]*mv[r++]; if(ret>=10){//如果是两位数 int b,c;//分别记录十位和个位 b=ret/10; mv.push_back(b); if(mv.size()==n) break; c=ret%10; mv.push_back(c); if(mv.size()==n) break; } else{//乘出来是一位数 mv.push_back(ret); //a1,a2需要发生改变 if(mv.size()==n) break; } } for(int i=0;i 81、今天我要赢 // 时间:2022.05.29 00点20分 #includeusing namespace std; int main () { cout<<"I'm gonna win! Today!"< 82、种钻石 // 时间:2022.05.29 00点22分 #includeusing namespace std; int main () { int a,b; cin>>a>>b; cout< 83、谁能进图书馆 // 时间:2022.05.29 22点04分 // 第一种:我写的 #include84、拯救外星人using namespace std; int main () { int a,b,c,d; cin>>a>>b>>c>>d; //第一行: //两个都能进 //两个都大于等于禁入年龄或者一个小于禁入年龄但是另一个人大于等于陪同年龄 if((c>=a&&d>=a)||(c=b)||(c>=b&&d=a&&c=a&&dd) {mmin=2,mmax=1;} else if(c mmin=1;mmax=2;} if((c>=b&&d=b&&c=a&&d>=a) printf("huan ying ru guann"); //如果两个人都进不去,则输出 zhang da zai lai ba; //c小于禁入年龄,d也小于禁入年龄 if(c=a&&c=a&&d // int main() // { // int a,b,c,d; // scanf("%d %d %d %d",&a,&b,&c,&d); // if(c>=a&&d>=a) //两个人的年龄都大于等于禁入年龄线 // { // printf("%d-Y %d-Yn",c,d); // printf("huan ying ru guan"); // } // else if(c>=a&&d // { // if(c>=b) //第一个人大于等于陪同年龄线 // { // printf("%d-Y %d-Yn",c,d); // printf("qing 1 zhao gu hao 2"); // } // else //第一个人小于陪同年龄线 // { // printf("%d-Y %d-Nn",c,d); // printf("1: huan ying ru guan"); // } // } // else if(d>=a&&c // { // if(d>=b) //第二个人大于等于陪同年龄线 // { // printf("%d-Y %d-Yn",c,d); // printf("qing 2 zhao gu hao 1"); // } // else //第二个人小于陪同年龄线 // { // printf("%d-N %d-Yn",c,d); // printf("2: huan ying ru guan"); // } // } // else //两个人都小于禁入年龄线 // { // printf("%d-N %d-Nn",c,d); // printf("zhang da zai lai ba"); // } // return 0; // } // 时间:2022.05.29 00点33分 #includeusing namespace std; int func(int n){ if(n==1) return 1; return n*func(n-1); } int main () { int a,b,c; cin>>a>>b; cout< 85、试试手气 // 时间:2022.06.07 22点12分 //第一种:yxc的 #include86、斯德哥尔摩火车上的题using namespace std; int main () { int a[6]; for(int i=0;i<6;i++) cin>>a[i]; int n; cin>>n; for(int i=0;i<6;i++) { for(int j=6,c=0;;j--) if(j!=a[i]&&++c==n) { if(i==5) cout< // using namespace std; // int a[7][7]; // int main () // { // for(int i=1;i<=6;i++){ // int t; // cin>>t; // a[i][t]=1; // } // int n; // cin>>n; // while(n--){//摇n次 // for(int i=1;i<=6;i++) // for(int j=6;j>0;j--){ // if(n==0&&a[i][j]==0&&i==1)//如果是最后一次摇,找到摇的点数并输出(每行第一个数字不加空格) // {cout< // a[i][j]=1; // break; // } // } // } // return 0; // } // 时间:2022.05.29 12点29分 #include#include using namespace std; int main () { string s1,s2; string a,b; cin>>a>>b; for (int i = 1; i < a.size(); i++) { if (a[i] % 2 == a[i-1] % 2) { s1 += max(a[i], a[i-1]); } } for (int i = 1; i < b.size(); i++) { if (b[i] % 2 == b[i-1] % 2) { s2 += max(b[i], b[i-1]); } } if(s1==s2) cout< 87、机工士姆斯塔迪奥 // 时间:2022.05.29 10点44分 //第一种:优美版: #include#include #include using namespace std; int main () { int n,m,q; set hh,ll;//hh是行号的集合,ll是列号的集合,set可以自动判重 cin>>n>>m>>q; while(q--){ int t,c; cin>>t>>c; if(t==0){//行号 hh.insert(c); } else if(t==1){//列号 ll.insert(c); } } cout< // using namespace std; // int main () // { // int n,m,q; // cin>>n>>m>>q; // int arr[n+10][m+10]; // for(int i=1;i<=n;i++) // for(int j=1;j<=m;j++) // arr[i][j]=0; // while(q--){ // int t,c; // cin>>t>>c; // if(t==0)//选择第c行 // for(int i=1;i<=m;i++) // arr[c][i]=1; // else if(t==1)//选择第c列 // for(int i=1;i<=n;i++) // arr[i][c]=1; // } // int sum=0; // for(int i=1;i<=n;i++) // for(int j=1;j<=m;j++) // if(arr[i][j]==0) // sum++; // cout< 88、静静的推荐 // 时间:2022.06.07 22点41分 #include#include using namespace std; int cnt[300]; int main () { int n,k,s; cin>>n>>k>>s; int res=0;//推荐的人数 while(n--) { int a,b; cin>>a>>b; if(a>=175)//只有分数大于等于175才有资格 { //如果某学生pat考试的成绩大于等于分数线,则直接推荐 if(b>=s) res++; //如果某学生只是天梯赛成绩大于等于175,则这个分数的人加一 else cnt[a]++; } } for(int i=175;i<=290;i++) //因为只能k次推荐,所以每个分数推荐的人数是这个分数的人数和k的最小值 res+=min(cnt[i],k); printf("%dn",res); return 0; }



