1716 too simple....

This commit is contained in:
mhrooz 2023-12-06 13:33:32 +01:00
parent 2df78dec1d
commit 5e99323cdc

View File

@ -0,0 +1,31 @@
#include<stdcpp.h>
using namespace std;
class Solution{
public:
int totalMoney(int n){
int monday = 0;
int rlt = 0;
for(int i = 1 ; i<=n ;i++){
if(i%7==1){
monday = monday + 1;
rlt += monday;
cout<<monday<<endl;
}else{
int amount = i%7;
if(!amount) amount = 7;
cout<< monday + amount - 1 <<endl;
rlt += monday + amount - 1 ;
}
}
cout<<endl;
return rlt;
}
};
int main(){
int n;
Solution sol;
cout<<sol.totalMoney(4)<<endl;
cout<<sol.totalMoney(10)<<endl;
cout<<sol.totalMoney(20)<<endl;
}