校园网站开发设计报告,seo优化技术排名,海南建设大厅网站,wordpress让超链接不显示蓝字目录
试题A #xff1a;门牌制作
试题B #xff1a;既约分数
试题C #xff1a;蛇形填数
试题D #xff1a;跑步训练
试题E #xff1a;七段码
试题F #xff1a;成绩统计
试题G #xff1a;回文日期
试题H #xff1a;字串分值
试题I #xff1a;平面切分门牌制作
试题B 既约分数
试题C 蛇形填数
试题D 跑步训练
试题E 七段码
试题F 成绩统计
试题G 回文日期
试题H 字串分值
试题I 平面切分不会
试题J : 字串排序不会 试题A 门牌制作 #include bits/stdc.h
using namespace std;const int N 100000;
int arr[N];int main()
{int ans 0,t;for(int i 1;i 2020;i){t i;while(t 0){if(t % 10 2) ans;t / 10;}}coutansendl;return 0;
}
试题B 既约分数 #include bits/stdc.h
using namespace std;int gcd(int a,int b)
{if(a % b 0) return b;return gcd(b,a % b);
}int main()
{int ans 0;for(int i 1;i 2020;i){for(int j 1;j 2020;j){if(gcd(i,j) 1) ans;}}coutansendl;return 0;
}
试题C 蛇形填数 #include bits/stdc.h
using namespace std;int arr[100][100];int main()
{int sum 1; for(int i 0;i 50;i){//奇数行-列 if(i % 2 1){for(int xi,y1;x 0 y i;x--,y)arr[x][y] sum;}//偶数行列-else{for(int x1,yi;x i y 0;x,y--)arr[x][y] sum;} }coutarr[20][20]endl;return 0;
}
试题D 跑步训练 #include bits/stdc.h
using namespace std;bool judge(int year)
{if(year % 400 0 || year % 4 0 year % 100 ! 0)return true;return false;
}int main()
{int month[12] {31,28,31,30,31,30,31,31,30,31,30,31};int sum 0;int w 6;for(int y 2000;y 2020;y){if(judge(y)) month[1] 29;for(int m1;m 12;m){for(int d 1;d month[m-1];d){if(d 1 || w 1) sum 2;else sum;w w % 7 1; if(y 2020 m 10 d 1) coutsumendl;}}month[1] 28;}return 0;
}
试题E 七段码 #include bits/stdc.h
using namespace std;//是否连通
bool con[8][8];
bool vis[8];
int father[8];
int sum;int f(int n)
{if(father[n] n) return n;else{father[n] f(father[n]);return father[n];}
}void dfs(int n)
{if(n 7){for(int i 1;i 7;i)father[i] i;for(int i 1;i 7;i){for(int j 1;j 7;j){if(vis[i] vis[j] con[i][j]){int x f(i);int y f(j);if(x ! y)father[x] y;}}}int k 0;for(int i 1;i 7;i){if(vis[i] father[i] i) k;}if(k 1) sum;return;}vis[n] 1;dfs(n1);vis[n] 0;dfs(n1);
}int main()
{con[1][2]con[1][6]1;con[2][1]con[2][7]con[2][3]1;con[3][7]con[3][4]con[3][2]1;con[4][5]con[4][3]1;con[5][4]con[5][7]con[5][6]1;con[6][1]con[6][7]con[6][5]1;con[7][6]con[7][5]con[7][2]con[7][3]1;dfs(1);coutsumendl;return 0;
}
试题F 成绩统计 【样例输入】
7
80
92
56
74
88
100
0【样例输出】
71%
43%#include bits/stdc.h
using namespace std;int n,n1,n2;
float a,b;int main()
{cinn;int score;for(int i 1;i n;i){cinscore;if(score 60) n1;if(score 85) n2;}a 1.0f * n1 / n * 100;b 1.0f * n2 / n * 100;printf(%.0f%%\n,a);printf(%.0f%%\n,b);return 0;
}
试题G 回文日期 #include bits/stdc.h
using namespace std;bool judge(int n)
{int t n;int reverse 0;while(t reverse){reverse reverse * 10 t % 10;t / 10;}//coutreverse--t;return t reverse || reverse / 10 t;
}
bool judgeYear(int n)
{if(n % 400 0 || n % 4 0 n % 100 ! 0)return true;return false;
}
bool judge2(int x)
{int s[8];int m1000000;int n10;s[0]x/10000000;for(int i1;i8;i,m/10){s[i]x/m%n;}if(s[0]s[2]s[2]s[5]s[5]s[7]s[1]s[3]s[3]s[4]s[4]s[6]){return true;}else return false;
}int main(){int n,str,flag1 0,flag2 0;cinn;int month[13] {0,31,28,31,30,31,30,31,31,30,31,30,31};for(int y n / 10000;true;y){str y * 10000;int m;if(y n / 10000) m n / 100 % 100;else m 1;for(;m 12;m){str m * 100;int d;if(y n / 10000 m n / 100 % 100) d n % 100 1;else d 1;for(;d month[m];d){str d;if(flag1 0 judge(str)){coutstrendl;flag1 1;}if(flag2 0 judge2(str)){coutstrendl;flag2 1;}str - d;}if(flag1 flag2) break;str - m * 100;}if(flag1 flag2) break;}return 0;
}
试题H 字串分值 【样例输入】
ababc【样例输出】
28【样例说明】
子串 f值
a 1
ab 2
aba 2
abab 2
ababc 3b 1ba 2bab 2babc 3a 1ab 2abc 3b 1bc 2c 1#include bits/stdc.h
using namespace std;int ans;
setchar s; int main()
{string str;cinstr;for(int i 0;i str.length();i){s.clear();for(int j i;j str.length();j){s.insert(str[j]);ans s.size();}}coutansendl;return 0;
}
试题I 平面切分不会 【样例输入】
3
1 1
2 2
3 3【样例输出】
6试题J : 字串排序不会 【样例输入】
4【样例输出】
bbaa【样例输入】
100
【样例输出】
jihgfeeddccbbaa