标签:das == gets plain fine 一个 __int64 get strlen
题意:第i个数是pi给礼物编号i送礼的朋友的编号(啊绕死)
2(1) 3(2) 4(3) 1(4)
4 (1)1(2) 2(3) 3(4)
啊没错就是位置和数字换过来!
代码:
//???????£???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 m[200]; int n; cin >> n; for(int i = 1;i <= n;i++){ int x; cin >> x; m[x] = i; } for(int i = 1;i <= n;i++){ if(i == 1) cout << m[i] ; else cout << " " << m[i]; } }
题意:就是给出一组数,改变其中一个数使和最小(?)然后还要排序
代码:
//???????£???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 a[200005]; int main(){ int n; cin >> n; for(int i = 0;i < n;i++){ cin >> a[i]; } sort(a,a+n); if(a[n-1] == 1){ a[n-1] = 2; }else a[n-1] = 1; sort(a,a+n); for(int i = 0;i < n;i++){ if(i == 0){ cout << a[i]; }else{ cout << " " << a[i]; } } cout << endl; }
题意:给出一串字符,将aoyeui去掉,大写变小写,每个字符前加个点,输出
做法:写超长一个if,之后去大写,之后输出
代码:
//???????£???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(){ char a[200]; char ss[200]; gets(a); int len; len = strlen(a); int j; int sum = 0; for(int i=j = 0;i < len;i++){ if(a[i] != ‘A‘ && a[i] != ‘O‘ && a[i] != ‘Y‘ && a[i] != ‘E‘ && a[i] != ‘U‘ && a[i] != ‘I‘ && a[i] != ‘a‘ && a[i] != ‘o‘ && a[i] != ‘y‘ && a[i] != ‘e‘ && a[i] != ‘i‘ && a[i] != ‘u‘){ ss[j] = a[i]; j++; sum++; } } int len2; len2 = strlen(ss); // for(int i = 0;i < len2;i++){ // cout << ss[i] << " "; // } for(int i = 0;i < sum;i++){ if(ss[i] >= ‘A‘ && ss[i] <= ‘Z‘){ ss[i] += 32; } } for(int i = 0;i < sum;i++){ cout << "." << ss[i]; } cout << endl; }
题意:PASS
做法:把要输出的分成三层,i<n一层,i == n一层,i>n一层,控制好格式,输出就行
//???????£???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; int j; //dadwdas for(int i = 0;i < 2*n+1;i++){ if(i < n){ for(j = n-i;j > 0;j--){ cout << " "; } for(j = 0;j < i;j++){ cout << j << " "; } for(j = i;j >= 0;j--){ if(j == 0){ cout << j; }else{ cout << j << " "; } } } if(i == n){ for(j = 0;j < n;j++){ cout << j << " "; } for(;j >= 0;j--){ if(j == 0){ cout << j; }else{ cout << j << " "; } } } if(i > n){ for(j = i-n;j > 0;j--){ cout << " "; } for(j = 0;j < (2*n+1)-i-1;j++){ cout << j << " "; } for(j = (2*n+1)-i-1;j >= 0;j--){ if(j == 0){ cout << j; }else{ cout << j << " "; } } } cout << endl; } }
标签:das == gets plain fine 一个 __int64 get strlen
原文地址:https://www.cnblogs.com/CCCCrack/p/13977557.html