2020.10.30 Rating 补题报告
A - Bachgold Problem
做法:直接全输出2就行,奇数就多输出一个3
代码:
//ȥ������£���AC�����Ȼ����� // ******** // ************ // ####....#. // #..###.....##.... // ###.......###### // ........... // ##*####### // ####*******###### // ...#***.****.*###.... // ....**********##..... // ....**** *****.... // #### #### // ###### ###### #include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<string> #include<map> #include<sstream> #include<cstring> #include<vector> #include<iomanip> #include<queue> #include<set> #define LL long long #define _64 __int64 const double PI = atan(1.)*4.; using namespace std; int main(){ int n; cin >> n; cout << n/2 << endl; for(int i = 0;i < n/2-1;i++){ cout << 2 << " "; //if(n % 2 == 0){ // cout << 2 << // } } if(n % 2 == 0){ cout << 2 << endl; }else{ cout << 3 << endl; } }
B - Parallelogram is Back
题意:给出一个平行四边形其中三个点的坐标,求第四个坐标
做法:数学题,用中点公式即可
代码:
//ȥ������£���AC�����Ȼ����� // ******** // ************ // ####....#. // #..###.....##.... // ###.......###### // ........... // ##*####### // ####*******###### // ...#***.****.*###.... // ....**********##..... // ....**** *****.... // #### #### // ###### ###### #include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<string> #include<map> #include<sstream> #include<cstring> #include<vector> #include<iomanip> #include<queue> #include<set> #define LL long long #define _64 __int64 const double PI = atan(1.)*4.; using namespace std; int main(){ int ax,ay,bx,by,cx,cy; int x1,x2,x3,y1,y2,y3; cin >> ax >> ay; cin >> bx >> by; cin >> cx >> cy; cout << 3 << endl; cout << bx-ax+cx << " " << by-ay+cy << endl; cout << cx-bx+ax << " " << cy-by+ay << endl; cout << ax-cx+bx << " " << ay-cy+by << endl; }
D - Vladik and flights
题意:在机场之间飞,相同的机场不要钱,不同的要相邻距离绝对值那么多钱,问从一个点到另一个点最少花费
做法:只有0和1两个答案,若是相同的起点终点直接飞,不同的就相邻着找,找到相同的为止
代码:
//ȥ������£���AC�����Ȼ����� // ******** // ************ // ####....#. // #..###.....##.... // ###.......###### // ........... // ##*####### // ####*******###### // ...#***.****.*###.... // ....**********##..... // ....**** *****.... // #### #### // ###### ###### #include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<string> #include<map> #include<sstream> #include<cstring> #include<vector> #include<iomanip> #include<queue> #include<set> #define LL long long #define _64 __int64 const double PI = atan(1.)*4.; using namespace std; char s[200005]; int main(){ int a,b,n; cin >>n >> a >> b; cin >> s ; if(s[a-1] == s[b-1]){ cout << 0 << endl; }else{ cout << 1 << endl; } }
E - Chloe and the sequence
题意:从1开始操作,每一次操作将原先的序列复制一份放到最后,再在中间插入大1的数,问数次操作之后某位置的数是多少
做法:这玩意比赛的时候都找出规律来了,,死活就是不会写,最后看了大佬的代码才勉勉强强看懂…………有规律,1+2x的位置都是1,2+4x的位置都是2……以此类推
代码:
//ȥ������£���AC�����Ȼ����� // ******** // ************ // ####....#. // #..###.....##.... // ###.......###### // ........... // ##*####### // ####*******###### // ...#***.****.*###.... // ....**********##..... // ....**** *****.... // #### #### // ###### ###### #include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<string> #include<map> #include<sstream> #include<cstring> #include<vector> #include<iomanip> #include<queue> #include<set> #define LL long long #define _64 __int64 const double PI = atan(1.)*4.; using namespace std; LL pow(LL x,LL n){ LL res = 1; while(n){ if(n & 1){ res = res * x; } x *= x; n >>= 1; } return res; } int main(){ LL n, k; cin >> n >> k; for (int i = 0;;i++){ LL temp = pow(2, i); if((k - temp) % (temp * 2) == 0){ cout << i + 1 << endl; break; } } }
F - Vladik and fractions
题意:给出一个n,求满足1/x + 1/y + 1/z = 2/n的x、y、z的值
做法:我是万万没想到这都有公式……
代码:
//ȥ������£���AC�����Ȼ����� // ******** // ************ // ####....#. // #..###.....##.... // ###.......###### // ........... // ##*####### // ####*******###### // ...#***.****.*###.... // ....**********##..... // ....**** *****.... // #### #### // ###### ###### #include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<string> #include<map> #include<sstream> #include<cstring> #include<vector> #include<iomanip> #include<queue> #include<set> #define LL long long #define _64 __int64 const double PI = atan(1.)*4.; using namespace std; int main(){ int n; cin >> n; if(n == 1){ cout << -1 << endl; return 0; } int a, b, c; a = n; b = n + 1; c = n * (n + 1); cout << a << " " << b << " " << c << endl; }

2020.10.30 Rating 补题报告
浙公网安备 33010602011771号