题意:输入一本书的页数和周一到周末每天看多少页,求看完的那天是星期几。
Example
Input
100 15 20 20 15 10 30 45
Output
6
Input
2 1 0 0 0 0 0 0
Output
1
#include<iostream>
#include <cstdio>
using namespace std;
int main (void)
{
int sum=0,n,i,week[7];
cin>>n;
for( i=0;i<7;i++) cin>>week[i];
for(i=0;sum<n;i++) sum+=week[i%7];
if(i%7==0)
cout<<"7"<<endl;
else
cout<<(i)%7<<endl;
return 0;
}