QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#400333 | #6696. Three Dice | liutaowoaini# | WA | 0ms | 3532kb | C++17 | 1.0kb | 2024-04-27 10:18:56 | 2024-04-27 10:18:57 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
int hei[4] = { 2,3,5,6 };
int h[2] = { 1,4 };
void solve()
{
int a, b;
cin >> a >> b;
if (b != 0)
{
if (a == 1 || a == 4)//一个红色
{
for (int i = 0; i < 4; i++)
{
for (int j = i; j < 4; j++)
{
if (hei[i] + hei[j] == b)
{
cout << "Yes" << endl;
return;
}
}
}
}
else if (a == 2 || a == 5 || a == 8)//两个红
{
for (int i = 0; i < 4; i++)
{
if (hei[i] == b)
{
cout << "Yes" << endl;
return;
}
}
}
}
else//三个红
{
for (int i = 0; i < 2; i++)
{
for (int j = i; j < 2; j++)
{
for (int k = j; k < 2; k++)
{
int sum = h[i] + h[j] + h[k];
if (sum == a)
{
cout << "Yes" << endl;
return;
}
}
}
}
}
cout << "No" << endl;
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
t = 1;
cin >> t;
while (t--)
{
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3532kb
input:
4 5
output:
No No No No
result:
wrong answer expected YES, found NO