#include<bits/stdc++.h>
using namespace std;intmain(){int n;
cin >> n;if(n %5==0|| n %5==4){//后两天晒网
cout <<"Lying"<< endl;}else{
cout <<"Fishing"<< endl;//前三天打渔 }return0;}
数字加密
#include<bits/stdc++.h>
using namespace std;intmain(){char c[4];
cin >> c;for(int i =3; i >=0; i --){//倒过来枚举 //'9' - c[i]得到对调后的数字 //'9' - c[i]得到对调后的数字的ASCII码
cout <<char('9'- c[i]+'0');}return0;}
双质数
#include<bits/stdc++.h>
using namespace std;
bool isPrime(int x){if(x <2)return false;//特判 for(int i =2; i <= x / i; i ++){if(x % i ==0){return false;}}return true;}intmain(){int a, b;
cin >> a >> b;
bool flag = false;for(int i = a; i <= b; i++){if(isPrime(i)&&isPrime(i /10)){
cout << i << endl;
flag = true;}}if(!flag){//说明没有找到双质数
cout <<"None"<< endl;}return0;}
连乘问题
#include<bits/stdc++.h>
using namespace std;constint N =1e5+9, MOD =1e4;int n, a[N], b[N], c[N];intmain(){scanf("%d",&n);for(int i =1; i <= n; i ++){scanf("%d",&a[i]);}
b[0]=1;for(int i =1; i <= n; i ++){//前缀积
b[i]= b[i -1]* a[i]% MOD;}
c[n +1]=1;for(int i = n; i >=1; i --){//后缀积
c[i]= c[i +1]* a[i]% MOD;}for(int i =1; i <= n; i ++){printf("%d\n", b[i -1]* c[i +1]% MOD);}return0;}
救援争先
#include<bits/stdc++.h>
using namespace std;int n;structteam{int depart, arrive, id;}t[1005];
bool cmp(team a, team b){if(a.arrive < b.arrive)return true;if(a.arrive == b.arrive){if(a.depart < b.depart)return true;if(a.depart == b.depart){if(a.id < b.id)return true;}}return false;}intmain(){
cin >> n;for(int i =1; i <= n; i ++){int x, y;char ch;
cin >> x >> ch >> y;
t[i].depart = x *60+ y;//第i只队伍的出发时间
cin >> x >> ch >> y;
t[i].arrive = t[i].depart + x *60+ y;//第i只队伍的到达时间
t[i].id = i;//第i只队伍的编号 }sort(t +1, t +1+ n, cmp);//根据题目中的规则进行排序 for(int i =1; i <= n; i ++) cout << t[i].id << endl;return0;}