B. Dice Tower---------- 사유
7139 단어 사유Codeforces
He has an unlimited supply of these dice and wants to build a tower by stacking multiple dice on top of each other, while choosing the orientation of each dice. Then he counts the number of visible pips on the faces of the dice.
For example, the number of visible pips on the tower below is 29 — the number visible on the top is 1, from the south 5 and 3, from the west 4 and 2, from the north 2 and 4 and from the east 3 and 5.
The one at the bottom and the two sixes by which the dice are touching are not visible, so they are not counted towards total.
Bob also has t favourite integers xi, and for every such integer his goal is to build such a tower that the number of visible pips is exactly xi. For each of Bob’s favourite integers determine whether it is possible to build a tower that has exactly that many visible pips.
Input The first line contains a single integer t (1≤t≤1000) — the number of favourite integers of Bob.
The second line contains t space-separated integers xi (1≤xi≤1018) — Bob’s favourite integers.
Output For each of Bob’s favourite integers, output “YES” if it is possible to build the tower, or “NO” otherwise (quotes for clarity).
Example inputCopy 4 29 34 19 38 outputCopy YES YES YES NO Note The first example is mentioned in the problem statement.
In the second example, one can build the tower by flipping the top dice from the previous tower.
In the third example, one can use a single die that has 5 on top.
The fourth example is impossible.
제목: n개의 체탑이 있는데 너에게 숫자를 하나 줄게. 체를 쌓아 놓고 밖으로 드러난 숫자의 합이 이 숫자인지 물어봐.예, 출력 YES 아니요 출력 NO
해석: 하나의 체에 대해 1과 6이 서로 대응하고 5와 2가 서로 대응하며 4와 3이 서로 대응한다.그것들은 모두 7과 같기 때문에 한 체의 총계는 21이다.제목에 가려진 면이 있을 거예요. 그러면 15, 16, 17, 18, 19일 수도 있어요.만약에 체탑이 맨 위에 있는 체를 제외하고 밑에 있는 것은 모두 2면으로 가려진다면 -7.그래서 맨 위에 있는 체를 하나하나 들면 그 면을 가리고 남은 것은 14의 배수만 있으면 된다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[10]={15,16,17,18,19,20};
ll x;
int t;
ll res[1000005];
void slove(ll x)
{
if(x<15)
{
puts("NO");
return ;
}
for(int i=0;i<6;i++)
{
if((x-a[i])%14==0)
{
puts("YES");
return ;
}
}
puts("NO");
}
int main()
{
cin>>t;
for(int i=0;i<t;i++) cin>>res[i];
for(int i=0;i<t;i++)
{
slove(res[i]);
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
codeforce 991E(조합수 반복 검색)제목 링크: 링크 열기 클릭 샤오밍이 헷갈릴 때 본 자동차 번호판 숫자를 실제 숫자와 비교해 보자. ① 실제로 나온 숫자는 샤오밍이 다 봤다 ② 샤오밍은 같은 숫자만 보고 적을 수는 없다 ③ 차량 번호는 전도 제로가...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.