A, B, C, D, E Five people went fishing together one night, and by the early hours of the next morning they were all tired _abcde five people went fishing together one night

Source: Internet
Author: User
A, B, C, D, E five people in one night in partnership to fish, to the next morning when all tired, so they ask for a place to sleep. On day three, a first wakes up, he divides the fish into five parts, throws away the extra fish and takes one of his own. b The second one wakes up and divides the fish into five parts, throwing away one of the extra fish. C, D, E wake up in turn, also in the same way to get the fish. Ask them how many fish they've caught at least, and how many fish they saw each time they woke up.

#include <stdio.h>
int main () {
    int n,x,j,k,l,m;
    for (n=5;; n++) {
        j=4* (n-1)/5;
        k=4* (j-1)/5;
        l=4* (k-1)/5;
        m=4* (L-1)/5;
        if (n%5==1&&j%5==1&&k%5==1&&l%5==1&&m%5==1) {
            printf ("At least partnership fishing:%d \ n", n);
            printf ("Distribution of fishing strips:%d%d%d%d\n", j,k,l,m);
            break;
        }
    }
    return 0;
}


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.