1716 too simple....
This commit is contained in:
parent
2df78dec1d
commit
5e99323cdc
31
1716-20231206-pass/main.cpp
Normal file
31
1716-20231206-pass/main.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user