0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 23:16:27 +00:00

P1200 [USACO1.1]你的飞碟在这儿Your Ride Is Here

R39707205
This commit is contained in:
Baoshuo Ren 2020-10-12 21:17:06 +08:00 committed by Baoshuo Ren
parent f3fdb0ad30
commit 0503a0264c
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68
2 changed files with 65 additions and 0 deletions

23
problem/P1200/P1200.cpp Normal file
View File

@ -0,0 +1,23 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int us = 1, zs = 1;
string a, b;
getline(cin, a);
getline(cin, b);
for (int i = 0; i < 7; i++) {
if (a[i] <= 0) break;
else us *= a[i] - 64;
}
for (int i = 0; i < 7; i++) {
if (b[i] <= 0) break;
else zs *= b[i] - '@';
}
us %= 47;
zs %= 47;
if (us == zs) cout << "GO" << endl;
else cout << "STAY" << endl;
return 0;
}

42
problem/P1200/solution.md Normal file
View File

@ -0,0 +1,42 @@
## 思路
按照题意计算即可。
## 代码
```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
int us = 1, zs = 1;
string a, b;
getline(cin, a);
getline(cin, b);
for (int i = 0; i < 7; i++) {
if (a[i] <= 0) break;
else us *= a[i] - 64;
}
for (int i = 0; i < 7; i++) {
if (b[i] <= 0) break;
else zs *= b[i] - '@';
}
us %= 47;
zs %= 47;
if (us == zs) cout << "GO" << endl;
else cout << "STAY" << endl;
return 0;
}
```
## 后记
- Update12019-07-10
无说明。
- Update22020-10-12
- 优化代码
- 弃用不安全的 `gets` 函数。