您的位置:首页 > 其它

codeforces 670A Holidays

2016-05-06 11:35 183 查看
题目的意思就是给出一年的天数,求最少和最多有多少天的假。

最多有5天工作,2天放假,先求最多可能有多少个完整的周,然后在把多余的天数算作工作或者是放假就好了。
#include <bits/stdc++.h>

using namespace std;

void file()
{
freopen("C:\\Users\\MrZis\\Desktop\\input.txt", "r", stdin);
freopen("C:\\Users\\MrZis\\Desktop\\output.txt", "w", stdout);
return ;
}

int main()
{
int n;
scanf("%d", &n);
int res = 2 * (n / 7);
int tmp = n % 7;
//cout << tmp << endl;
if (tmp == 0)
{
printf("%d %d", res, res);
return 0;
}
else if (tmp == 1)
{
printf("%d %d\n", res, res + 1);
return 0;
}
else if (tmp == 2)
{
printf("%d %d\n", res, res + 2);
return 0;
}
else if (tmp == 3)
{
printf("%d %d\n", res, res + 2);
return 0;
}
else if (tmp == 4)
{
printf("%d %d\n", res, res + 2);
return 0;
}
else if (tmp == 5)
{
printf("%d %d\n", res, res + 2);
return 0;
}
else if (tmp == 6)
{
printf("%d %d\n", res + 1, res + 2);
return 0;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: