昨天很多人都在玩,我于是也试了一下……
https://paiza.jp/poh/ando
花了一个半小时,心累。
放一下最后三道题吧:
眼镜:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
#include <iostream> #include <vector> using namespace std; vector< vector<int> > surface1; vector< vector<int> > surface2; int x_final, y_final; void find(int size1, int size2) { for (int i = 0; i < size1 - size2 + 1; ++i) for (int j = 0; j < size1 - size2 + 1; ++j) { bool flag = true; for (int x = 0; x < size2; ++x) { for (int y = 0; y < size2; ++y) if (surface2[x][y] != surface1[i + x][j + y]) { flag = false; break; } if (!flag) break; } if (flag) { x_final = i; y_final = j; return; } } } int main() { int size1, size2; cin >> size1; surface1.resize(size1); for (int i = 0; i < size1; ++i) for (int j = 0; j < size1; ++j) { int temp; cin >> temp; surface1[i].push_back(temp); } cin >> size2; surface2.resize(size2); for (int i = 0; i < size2; ++i) for (int j = 0; j < size2; ++j) { int temp; cin >> temp; surface2[i].push_back(temp); } find(size1, size2); cout << x_final << " " << y_final << endl; return 0; } |
圣诞服:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
#include <iostream> #include <vector> #include <algorithm> using namespace std; vector<int> side; vector<int> front; int X, Y, Z; int minX, minY, minZ; void slice(int status, int position) { if (status == 1) { for (vector<int>::iterator it = side.begin(); it != side.end() - 1; ++it) if (*it < position && *(it + 1) > position) minY = min(position - *it, *(it + 1) - position); side.push_back(position); sort(side.begin(), side.end()); } else { for (vector<int>::iterator it = front.begin(); it != front.end() - 1; ++it) if (*it < position && *(it + 1) > position) minX = min(position - *it, *(it + 1) - position); front.push_back(position); sort(front.begin(), front.end()); } return ; } int main() { int times; cin >> X >> Y >> Z >> times; minX = X; minY = Y; minZ = Z; front.push_back(0); front.push_back(X); side.push_back(0); side.push_back(Y); for (int i = 0; i < times; ++i) { int status, position; cin >> status >> position; slice(status, position); } cout << minX * minY * minZ << endl; } |
泳衣:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
#include <iostream> using namespace std; typedef long long LL; LL process(LL input) { while (input % 10 == 0) input /= 10; return input % 1000000000000; } LL fact(int need) { LL ans = 1; for (int i = 2; i <= need; ++i) { ans *= i; ans = process(ans); } return ans; } int main() { int need; cin >> need; cout << fact(need) % 1000000000 << endl; } |
女朋友真的能这样吗(◎-◎;)
我用 js 也给女朋友装扮了一下啦
哈哈哈哈……
哈哈哈……
哈哈……
哈……
……
http://blog.e10t.net/single-bell-2015/