QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#97425 | #3614. Math Trade | shushu | WA | 2ms | 3372kb | C++14 | 1018b | 2023-04-16 19:20:35 | 2023-04-16 19:20:37 |
Judging History
answer
#include <iostream>
using namespace std;
struct Trade {
string name;
string have;
string want;
};
int main() {
int n;
cin >> n;
struct Trade a[100];
int y=1,z,w=0;
string x;
for(int i=0;i<n;i++){
cin >> a[i].name >> a[i].have >> a[i].want;
if(i>0)
if(a[i].have == a[i-1].want){
y++;
if(y==2){
x=a[i-1].have;
z=i-1;
}
}else{
if(a[i].want == x){
y++;
}
else{
z++;
x=a[z].have;
if(a[i].want==x)
y++;
else{
w=1;
break;
}
}
}
}
if(w!=1)
cout << y;
else
cout << "No trades possible";
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3372kb
input:
4 Sally Clock Doll Steve Doll Painting Carlos Painting Clock Maria Candlestick Vase
output:
No trades possible
result:
wrong answer 1st lines differ - expected: '3', found: 'No trades possible'