社区讨论
80分 #4 WA
P1603斯诺登的密码参与者 2已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @lrblywiw
- 此快照首次捕获于
- 2024/01/13 13:09 2 年前
- 此快照最后确认于
- 2024/01/13 15:35 2 年前
各位大佬,本蒟蒻又来请教问题了
P1603 80分 #4 WA,原因:
CPPtoo short on line 1
代码如下
CPP#include <bits/stdc++.h>
using namespace std;
string num1[25] = {"","one","two","three","four","five","six ","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty"};
string num2[5] = {"","a","another","first"};
string num3[5] = {"","both","second"};
string num4 = "third";
int ans[10];
int main()
{
int cnt = 0;
for (int i = 1;i <= 6;i ++)
{
string s;
cin >> s;
for (int j = 1;j <= 20;j ++)
{
if (s == num1[j]) ans[++ cnt] = j;
}
for (int j = 1;j <= 3;j ++)
{
if (s == num2[j]) ans[++ cnt] = 1;
}
for (int j = 1;j <= 3;j ++)
{
if (s == num3[j]) ans[++ cnt] = 2;
}
if (s == num4) ans[++ cnt] = 3;
}
if (cnt == 0)
{
cout << 0 << endl;
return 0;
}
for (int i = 1;i <= cnt;i ++)
{
ans[i] = ans[i] * ans[i] % 100;
}
sort(ans + 1,ans + cnt + 1);
for (int i = 1;i <= cnt;i ++)
{
if (i != 1 and ans[i] < 10) cout << 0;
cout << ans[i];
}
return 0;
}
谢谢各位大佬!
回复
共 1 条回复,欢迎继续交流。
正在加载回复...