美文网首页
2712细菌繁殖

2712细菌繁殖

作者: SUNRISE_05fd | 来源:发表于2018-10-14 20:41 被阅读0次

    ···

    include<iostream>

    using namespace std;
    int main()
    {
    int days[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
    int month_1, day_1, month_2, day_2, num;//定义起始结束时间
    cin >> month_1 >> day_1 >> num >> month_2 >> day_2;//输入时间
    int sum = 0;//计数
    for (int k = month_1; k < month_2; k++)
    {
    sum += days[k - 1];
    }
    sum -= day_1;
    sum += day_2;

        long nNum = num;
        for (int k = 0; k < sum; k++)
        {
            nNum *= 2;
        }
        cout << nNum << endl;
    }
    

    }
    ···
    一次过

    相关文章

      网友评论

          本文标题:2712细菌繁殖

          本文链接:https://www.haomeiwen.com/subject/nhmtzftx.html