蓝桥杯 - 穷举

#include<iostream>
#include<string.h>
using namespace std;
/*
 *  printf("%d",sizeof(long int));//4个字节,32位 ,可以表示 到65 536
    //short only 2 Byte ,8 bit;
    //8个字节, 64位,32位位 4 294 967 296
 */
int main()
{
    long int x =10; //10位数,10亿。
    long int  y=90;
    int time = 60;
    int time_t=time * 10;
    int t;

    for(t=5;t<=time_t;t+=5) //注意点2.任何小于time_t的时间间隔内其实不会再发生其他事情了
    {
        if(y<0)
        {
            y=0;
        } else {
            if (t % 5 == 0 && t % 10 != 0) y = y - x;
            if (t % 30 == 0) x = x * 2;
            if (t % 20 == 0) y = y * 2;
        }
    }
    printf("%ld",y);//注意3.前面注意注意到了数量了,后面输出而已一样。




    return 0 ;
}

猜你喜欢

转载自www.cnblogs.com/aria-garden/p/10481011.html