Cdoj 29 Dart (DART) Problem Solving report

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.