小鱼的航程
题目描述:
有一只小鱼,它上午游泳150公里,下午游泳100公里,晚上和周末都休息(实行双休日),假设从周x(1<=x<=7)开始算起,请问这样过了n天以后,小鱼一共累计游泳了多少公里呢?
输入格式:
输入两个整数x,n(表示从周x算起,经过n天)。
输出格式:
输出一个整数,表示小鱼累计游泳了多少公里。
样例输入1:
3 10
样例输出1:
2000
约定:
1<=n<=10000
#include<bits/stdc++.h>
using
namespace
std;
int
main() {
int
x;
int
n;
cin>>x>>n;
int
u=0;
int
b=0;
while
((x+b)%7!=1){
b++;
}
if
(b<=2){
u+=b;
}
else
{
u+=2;
}
int
w=(n-b)/7;
u+=w*2;
int
a=n-b-w*7;
if
(a>5) {
u+=a-5;
}
int
r=(n-u)*250;
cout<<r<<endl;
return
0;
}
原文:https://www.cnblogs.com/pxy071128fzm/p/13658461.html