China remainder theorem 1 (codevs 3040)

Source: Internet
Author: User

Title Description Description

Excerpt from an Introduction to algorithms ...

The number of the remainder is 2,3,2 when the first k is 3,5,7 removed;

Enter a description Input Description

A number k.

Output description Output Description

Find the number of K qualifying.

Sample input Sample Input

1

Sample output Sample Output

23

Data range and Tips Data Size & Hint

k>=1;

The answer is no more than the range that long long can store.

A typical number theory problem.

// Chinese remainder theorem water problem #include <cstdio>#include<iostream>usingnamespace  STD; int Main () {    longlong ans=, K;    Cin>>K;    Ans+ = (k1)*;    cout<<ans;     return 0 ;}
View Code

China remainder theorem 1 (codevs 3040)

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.