赞
踩
- #include<iostream>
- #include<cstdio>
- using namespace std;
- long long a,b,n;
-
- int main()
- {
- scanf("%lld%lld%lld",&a,&b,&n);
- long long arr[8];
- for(long long i = 1; i<=5;i++){
- arr[i] = a;
- }
- arr[0]=b;
- arr[6]=b;
- long long t=1;
- long long summ=0;
- while(summ<n){
- summ += arr[t%7];
- t++;
- }
- printf("%lld",t-1);
- return 0;
- }

- //while型判断最后的天数
- #include<iostream>
- #include<cstdio>
- using namespace std;
- int main()
- {
- long long a,b,n;
- scanf("%lld%lld%lld",&a,&b,&n);
- long long s = 5*a + 2*b;//一周的总天数
- long long t = n / s * 7;//整数个周*7得到天数
- long long d = n % s;//得到的d一定小于s
- long long arr[8] = {a,a,a,a,a,b,b};
- // for(int i = 0; i <7; i ++) cout<<arr[i]<<endl;
- long long summ = 0;
- long long i = 0;
- while(summ < d){
- //printf("$%lld\n",arr[0]);
- summ = summ + arr[i];
- // printf("$%lld\n",arr[0]);
- summ = summ + arr[i];
- // printf("$%lld\n",summ);
- t++;
- i++;
- //printf("***%d",tt);
- }
- printf("%lld",t);
- return 0;
- }
-

- //for型循环判断最后的天数
- #include<iostream>
- using namespace std;
- int main()
- {
- long long int a, b, n;
-
- cin >> a >> b >> n;
- long long arr[7] = {a,a,a,a,a,b,b};
-
-
- long long s = 5*a + 2*b;//一周的总天数
- long long t = n / s;//整数个周
- long long res = t * 7;
- long long d = n % s;//余下的天数
- for(int i = 0; d > 0; i++){
- d = d - arr[i];//不用再取余数了,因为肯定不满一周的时间
- res++;
- }
- printf("%lld",res);
- return 0;
- }

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。