摘要:
简单题,货币换算View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;int main(){ //freopen("D:\\t.txt", "r", stdin); int t, n, tt = 0; scanf("%d", &t); while (t--) { tt++; scanf("%d", &n) 阅读全文
摘要:
dfs+bfs,由于bfs的时候忘了加vis判断是否已入队,而多次超内存。View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>#include <queue>using namespace std;#define maxn 45struct XPoint{ int x, y, d; XPoint(int xx, int yy, int dd) : x(xx), y(yy), d(dd) { } XPoint() { }} s 阅读全文
摘要:
枚举第一串的所有子串,看其他串是否也有View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 11string st[maxn];int n;void input(){ scanf("%d", &n); getchar(); for (int i = 0; i < n; i++) getline(cin, st[i]);}void work( 阅读全文
摘要:
这题需要进行许多次四舍五入,得到最终结果,四舍五入的方法是(int)(x + 0.5)View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;int main(){ //freopen("D:\\t.txt", "r", stdin); int t; scanf("%d", &t); while (t--) { int n, coun 阅读全文
摘要:
用二分法求矩阵幂先把矩阵的2^x全算出来存入数组的第x位。然后读入n,从右至左遍历数组,能乘则乘,直到把n填满。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define w 10000;struct Pow2{ int matrix[2][2]; int num;} pow2[50];Pow2 mul(Pow2 &a, Pow2 &b){ Pow2 ret; for (i 阅读全文