题目连接:点击打开链接
解题思路:
模拟
完整代码:
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <set> using namespace std; const int INF = 1000000000; const int maxn = 10001; char a[maxn] , b[maxn]; void MyStrcat(char dstStr[] , char srcStr[]) { char c[maxn]; int cnt = 0; for(int i = 0 ; dstStr[i] ; i ++) c[cnt++] = dstStr[i]; for(int i = 0 ; srcStr[i] ; i ++) c[cnt++] = srcStr[i]; c[cnt++] = '\0'; for(int i = 0 ; c[i] ; i ++) printf("%c" , c[i]); cout << endl; } int main() { #ifdef DoubleQ freopen("in.txt" , "r" , stdin); #endif // DoubleQ while(cin >> a >> b) { MyStrcat(a , b); } }
题目连接:点击打开链接
解题思路:
此题完全可以增加难度的,而且感觉题意表述有问题,陌生人向富翁谈计划,那第一句口吻应该是陌生人说的。。。。可是最后确是以富翁口吻来解题。
完整代码:
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <set> using namespace std; const int INF = 1000000000; const int maxn = 10001; int main() { long long sum = 1; long long k = 1; for(int i = 2 ; i <= 30 ; i ++) { k = k * 2; sum += k; } cout << "300 " << sum << endl; }
题目连接:点击打开链接
解题思路:
这道题让我明白了九度上面时要用循环判断是否输入结尾才终止!!!
完整代码:
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <set> using namespace std; const int INF = 1000000000; const int maxn = 10001; long long a[4][4] , b[4][4]; long long c[4][4]; int main() { #ifdef DoubleQ freopen("in.txt" , "r" , stdin); #endif // DoubleQ while(cin >> a[0][0]) { cin >> a[0][1] >> a[0][2] >> a[1][0] >> a[1][1] >> a[1][2]; for(int i = 0 ; i < 3 ; i ++) { for(int j = 0 ; j < 2 ; j ++) { cin >> b[i][j]; } } for(int i = 0 ; i < 2 ; i ++) { for(int j = 0 ; j < 2 ; j ++) { long long sum = 0; for(int k = 0 ; k < 3 ; k ++) { sum += a[i][k] * b[k][j]; } c[i][j] = sum; } } for(int i = 0 ; i < 2 ; i ++) { for(int j = 0 ; j < 2 ; j ++) { cout << c[i][j] << " "; } cout << endl; } } }
时间: 2024-11-06 18:35:31