Accepted
Code
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n;
cin >>n;
long long ans=0,a,b;
while(n>=5)
{
if (n>=500)
{
a=n/500;
ans+=a*1000;
n=n%500;
}
else
{
b=n/5;
ans+=b*5;
n=n%5;
}
}
cout<<ans;
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1132 Festivity Frenzy!
- Contest
- Brain Booster #8
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-02-17 15:08:23
- Judged At
- 2025-02-17 15:08:23
- Judged By
- Score
- 100
- Total Time
- 1ms
- Peak Memory
- 772.0 KiB