Title Link: http://acm.uestc.edu.cn/#/problem/show/29
Compare the pit father of a problem, I was to play the table to find the law, and then prove the law ...
A little bit, random x refers to the need to include a double, if included one last time will say.
First of all, if the heart is not considered, if only one time, casually , then obviously only 1~k k~2k of the even 2k~3k three multiples can be cast.
If there are only two times left, including one last time, then obviously 2~3k can be filled.
For 3k~5k's score:
3k+t = 2K + k+t or 2k-2 + k+t+2
Can prove that for T is odd and even can be established
The boundary of the above formula:
5k-3 = 2K + 3k-3
5k-2 = 2k-2 + 3K
5K = 2K + 3K
Here you can see that 5k-1 is not available (if the 5k-1 happens to be a multiple of 3 can be taken)
If only two times, casually two times, then only the last time on the basis of the addition of 2k~3k, that is, in 5k-1~6k 3 of the multiple can be achieved.
If there are only three times left, it must be one last time.
Known, 2~5k In addition to 5k-1 can be achieved;
It can be seen that 2~8k in addition to 8k-1 is certainly attainable.
As long as two times inside each one is +3k can.
And because the maximum can only reach 8k= (3+3+2) K, do not consider the more.
So any value in 2~8k-2 or 8K can be taken.
Next consider Hearts:
If there is only one small red heart, refer to only two times, including one last time.
If you can have a big red heart, refer to only two times, casually two times.
If you can have a big red heart + a small hearts, refer to only one time, casually.
If there can be two big red hearts, refer to only one time, casually once.
If you can have two big hearts + a small red heart, refer to a p.
There is a small requirement that C must be greater than or equal to 2, presumably can understand it. However, the suspect, the data does not have this pit.
Forgive me for pressing the code so that I don't recognize it myself.
#include <cstdio>using namespace std;int K, M, C;bool able;int main() {while (~scanf("%d%d%d", &K, &M, &C) && (K || M || C)) {able = false;able |= C == M * 2 || C == M * 3 || C == M * 4 || C == M * 5 || C == M * 6;able |= C >= 2 && (C < K * 8 - 1 || C == K * 8);able |= (C -= M) >= 2 && (C < K * 5 - 1 || C == K * 5);able |= (C -= M) >= 0 && (C < K * 5 - 1 || C == K * 5 || C <= K * 6 && !(C % 3));able |= (C -= M) >= 0 && (C <= K || C <= K * 2 && !(C % 2) || C <= K * 3 && !(C % 3));able |= (C -= M) >= 0 && (C <= K || C <= K * 2 && !(C % 2) || C <= K * 3 && !(C % 3));puts(able ? "Yes" : "No");}return 0;}
Cdoj 29 Dart (DART) Problem Solving report