青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

Welcome to Leon's Blog  
日歷
<2025年12月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910
統計
  • 隨筆 - 30
  • 文章 - 0
  • 評論 - 51
  • 引用 - 0

導航

常用鏈接

留言簿(4)

隨筆分類

隨筆檔案

ACM

搜索

  •  

最新評論

閱讀排行榜

評論排行榜

 
     今天做完1006題,第一次用枚舉法,但是時間復雜度大,后來看到帖子說是用中國余數法。自己試著也寫了一個,但是用時也過大,現在把代碼貼出來,請大家幫忙改一改啊!謝謝了!
 1#include <stdio.h>
 2
 3int main(int argc, char* argv[])
 4{
 5    int p,e,i,d, index;
 6    int day;
 7    int x = 28*33*6;
 8    int y = 23*33*19;
 9    int z = 23*28*2;
10    index = 0;
11    
12
13    do
14    {
15        scanf("%d %d %d %d"&p,&e, &i, &d);
16        if(p == -1 && e == -1 && i == -1 && d == -1)
17            break;
18        p = p%23;
19        e = e%28;
20        i = i%33;
21        day = (p*+ e*+ i*z) % 21252;
22        if(day == d)
23            day += 21252;
24        printf("Case %d: the next triple peak occurs in %d days.\n"++index,day->= 0 ? day-d : day-d+21252);
25    }
while(1); 
26    return 0;
27}
posted on 2008-05-30 20:43 Leon916 閱讀(1241) 評論(4)  編輯 收藏 引用
評論:
  • # re: 1006求助  夜弓 Posted @ 2008-05-31 07:21
    /*
    Description
    Some people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they have periods of lengths 23, 28, and 33 days, respectively. There is one peak in each period of a cycle. At the peak of a cycle, a person performs at his or her best in the corresponding field (physical, emotional or mental). For example, if it is the mental curve, thought processes will be sharper and concentration will be easier.
    Since the three cycles have different periods, the peaks of the three cycles generally occur at different times. We would like to determine when a triple peak occurs (the peaks of all three cycles occur in the same day) for any person. For each cycle, you will be given the number of days from the beginning of the current year at which one of its peaks (not necessarily the first) occurs. You will also be given a date expressed as the number of days from the beginning of the current year. You task is to determine the number of days from the given date to the next triple peak. The given date is not counted. For example, if the given date is 10 and the next triple peak occurs on day 12, the answer is 2, not 3. If a triple peak occurs on the given date, you should give the number of days to the next occurrence of a triple peak.

    Input
    You will be given a number of cases. The input for each case consists of one line of four integers p, e, i, and d. The values p, e, and i are the number of days from the beginning of the current year at which the physical, emotional, and intellectual cycles peak, respectively. The value d is the given date and may be smaller than any of p, e, or i. All values are non-negative and at most 365, and you may assume that a triple peak will occur within 21252 days of the given date. The end of input is indicated by a line in which p = e = i = d = -1.

    Output
    For each test case, print the case number followed by a message indicating the number of days to the next triple peak, in the form:

    Case 1: the next triple peak occurs in 1234 days.

    Use the plural form ``days'' even if the answer is 1.

    Sample Input

    0 0 0 0
    0 0 0 100
    5 20 34 325
    4 5 6 7
    283 102 23 320
    203 301 203 40
    -1 -1 -1 -1

    Sample Output

    Case 1: the next triple peak occurs in 21252 days.
    Case 2: the next triple peak occurs in 21152 days.
    Case 3: the next triple peak occurs in 19575 days.
    Case 4: the next triple peak occurs in 16994 days.
    Case 5: the next triple peak occurs in 8910 days.
    Case 6: the next triple peak occurs in 10789 days.*/
    #include <cstdio>

    int main()
    {
    int x,y,z,s,t;
    size_t i(0);
    scanf("%d %d %d %d", &x, &y, &z, &s);
    while(x!=-1 || y!=-1 || z!=-1 || s!=-1){
    t = (5544*x + 14421*y + 1288*z) % 21252;
    t -= s;
    if(t<=0)
    t+=21252;
    printf("Case %d: the next triple peak occurs in %d days.\n",
    ++i,t);
    scanf("%d %d %d %d", &x, &y, &z, &s);
    }
    }
      回復  更多評論   

  • # re: 1006求助  夜弓 Posted @ 2008-05-31 07:31
    感覺沒多大區別,我的比你少取了點模
    40K 75MS
    至于哪些超快的,我覺得可能是這個原因:
    那句printf應該改成sprintf,先到緩沖區,最后再輸出~
    不過就算這樣能提高成績,我覺得其實意義也不大~  回復  更多評論   

  • # re: 1006求助  郴州SEO Posted @ 2008-06-01 07:34
    有點暈...  回復  更多評論   

  • # re: 1006求助  Leon916 Posted @ 2008-06-01 11:34
    哦,我在網上看到,有些人寫的程序時間和空間都很少,真不知道是怎么寫出來的  回復  更多評論   


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


 
Copyright © Leon916 Powered by: 博客園 模板提供:滬江博客
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            国产精品美女诱惑| 国产欧美日韩视频在线观看 | 欧美电影免费观看高清| 亚洲成人资源| 亚洲国产精品尤物yw在线观看| 欧美一区二区三区在线播放| 国产精品影院在线观看| 久久免费视频观看| 久久久久久伊人| 91久久国产综合久久| 亚洲黄色高清| 国产精品免费电影| 久久久久国产精品一区| 欧美成人精品影院| 中文国产成人精品| 欧美在线精品一区| 最新亚洲一区| 亚洲一区久久| 亚洲国产精选| 在线亚洲欧美| 影音先锋亚洲电影| 欧美激情亚洲自拍| 欧美日韩在线一区二区| 久久久国产亚洲精品| 欧美顶级少妇做爰| 欧美一区成人| 蜜桃久久精品乱码一区二区| 亚洲制服少妇| 久久综合九色99| 欧美一区二区三区免费视| 玖玖国产精品视频| 亚洲欧美国产高清| 欧美a级一区| 亚洲欧美综合精品久久成人| 免费成人av资源网| 欧美亚洲一区三区| 欧美日本一区二区视频在线观看| 欧美中文字幕久久| 欧美全黄视频| 久久综合伊人77777麻豆| 欧美三级视频在线| 亚洲国产人成综合网站| 国产一区二区丝袜高跟鞋图片 | 久久久久久久综合| 欧美日韩另类国产亚洲欧美一级| 久久男女视频| 国产麻豆一精品一av一免费| 亚洲欧洲在线看| 在线成人免费观看| 欧美综合激情网| 午夜久久久久久| 欧美日产国产成人免费图片| 免费av成人在线| 国产午夜精品视频| 在线综合亚洲欧美在线视频| 亚洲精品视频一区| 男人的天堂亚洲在线| 久久一区中文字幕| 国内精品视频久久| 欧美一区二区视频网站| 欧美在线影院| 国产日韩综合| 午夜视黄欧洲亚洲| 欧美一区二区黄| 国产精品男gay被猛男狂揉视频| av成人国产| 亚洲午夜精品一区二区| 欧美剧在线观看| 亚洲精品欧美精品| 99综合电影在线视频| 欧美激情一区二区三区不卡| 亚洲福利视频专区| 亚洲九九九在线观看| 欧美本精品男人aⅴ天堂| 亚洲电影免费观看高清完整版在线观看| 国产一区二区毛片| 久久精品国内一区二区三区| 麻豆精品传媒视频| 91久久线看在观草草青青| 欧美高清一区| 艳妇臀荡乳欲伦亚洲一区| 亚洲女与黑人做爰| 国产亚洲精品v| 久久九九热re6这里有精品| 免费观看久久久4p| 99精品国产在热久久| 欧美视频一二三区| 欧美一区1区三区3区公司| 免费不卡在线视频| 一本色道久久88亚洲综合88| 欧美午夜精品久久久久久浪潮| 亚洲一区二区三区在线看 | 制服丝袜激情欧洲亚洲| 欧美日韩一区在线视频| 小嫩嫩精品导航| 欧美成人中文字幕| 亚洲一级黄色| 国产综合色产在线精品| 欧美 日韩 国产在线| 一区二区欧美日韩| 久久琪琪电影院| 亚洲最新中文字幕| 国产日韩欧美| 欧美经典一区二区| 香蕉成人啪国产精品视频综合网| 欧美高清免费| 亚洲免费视频在线观看| 在线 亚洲欧美在线综合一区| 欧美日本韩国一区二区三区| 亚洲欧美日韩国产中文| 亚洲激情在线激情| 久久综合久久久| 亚洲一线二线三线久久久| 亚洲福利久久| 国产午夜精品久久| 欧美手机在线视频| 欧美国产免费| 久久久精品一品道一区| 亚洲在线1234| 日韩视频在线一区| 欧美激情久久久| 久久久天天操| 亚洲女同在线| 亚洲神马久久| 亚洲精选中文字幕| 亚洲国产精品成人精品| 国产日韩欧美在线一区| 欧美视频一区二区| 欧美日韩ab| 欧美激情片在线观看| 美女精品网站| 久久久91精品国产| 久久国产乱子精品免费女| 亚洲性视频网址| 一本大道久久精品懂色aⅴ| 亚洲高清在线| 欧美激情综合色| 免费日韩成人| 欧美777四色影视在线| 久久久九九九九| 久久久在线视频| 久久久亚洲午夜电影| 久久精品国产77777蜜臀| 性欧美video另类hd性玩具| 亚洲自拍另类| 午夜精品在线视频| 久久国产视频网| 久久精品国产亚洲5555| 久久精品1区| 久久人人97超碰精品888 | 一本色道久久综合亚洲二区三区| 亚洲国产乱码最新视频| 在线欧美日韩精品| 亚洲国产精品女人久久久| 亚洲激情在线| 日韩午夜剧场| 亚洲一区免费观看| 亚洲欧美日韩国产一区| 欧美在线观看你懂的| 久久久精彩视频| 欧美大片在线看| 亚洲人成人一区二区三区| 夜夜嗨av色一区二区不卡| 亚洲一区欧美激情| 久久久久久久一区二区| 噜噜噜在线观看免费视频日韩| 欧美成人精品激情在线观看| 欧美日韩美女在线观看| 国产乱码精品1区2区3区| 国产欧美三级| 亚洲伦理久久| 香蕉尹人综合在线观看| 久久综合久色欧美综合狠狠| 欧美激情一区二区三区| 亚洲最新在线视频| 久久精品亚洲一区二区| 欧美国产成人精品| 国产精品综合久久久| 在线欧美日韩国产| 亚洲综合导航| 欧美不卡高清| 亚洲欧美成人综合| 老色批av在线精品| 国产精品成人免费视频 | 国产精品视频第一区| 精品9999| 亚洲欧美日韩天堂一区二区| 蜜臀a∨国产成人精品| 亚洲少妇在线| 欧美成人精品激情在线观看| 国产精品一区二区你懂的| 亚洲国产人成综合网站| 欧美在线啊v| 亚洲欧洲一区二区三区| 久久久久国产一区二区三区| 国产精品福利片| 亚洲久久在线| 欧美成人免费一级人片100| 亚洲在线观看免费视频| 欧美日韩成人在线视频|