Poj-1006:biorhythms 1: Chinese remainder theorem

Source: Internet
Author: User

> Analysis

>> Three Cycles is three Inma, can be very simple to use the Chinese remainder theorem > attached Code
1 /* -------------------------2 * Chinese remainder theorem3  * -------------------------*/4#include"stdio.h"5 6 intMainvoid)7 {8     intp =0, E =0, i =0, d =0 ;9     intDays =0 ;Ten     intCount =0 ; One  A      while(1) -     { -scanf"%d %d%d%d", &p, &e, &i, &d); the         if(-1==d) -              Break ; -  -         /*5544 is the common multiple of 28 and 33, and 5544% is 1*/ +         /*14421 is the common multiple of 23 and 33, and 14421% = 1*/ -         /*1288 is the common multiple of 23 and 28, and 1288% = 1*/ +         /*21252 = * * **/ ADays = (5544* p +14421* E +1288* i)%21252 ; at         if(Days <=d) -Days + =21252 ; -  -printf"Case %d:the Next triple peak occurs in%d days.\r\n",  -++count, Days-d);  -     } in  -     return 0 ; to}

Poj-1006:biorhythms 1: Chinese remainder theorem

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.