Accepted
Code
#include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
int min_operations = 1e9;
for (int x = 0; x <= N / 3; x++) {
int remaining = N - (x * 3);
if (remaining % 2 == 0) {
int y = remaining / 2;
min_operations = min(min_operations, x + y);
}
}
cout << min_operations << endl;
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1106 A. too easy or three easy
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-07-28 18:41:13
- Judged At
- 2025-07-28 18:41:13
- Judged By
- Score
- 100
- Total Time
- 1ms
- Peak Memory
- 764.0 KiB