Problem choosingcandies
User yixin
Submission Time 2026-06-24 16:59:51
Score 0
Max Time N/A
Max Memory N/A

Compile Error

choosingcandies.cpp: In function ‘int main()’:
choosingcandies.cpp:9:2: error: ‘cin’ was not declared in this scope
9 | cin >> n >> k;
| ^~~
choosingcandies.cpp:4:1: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
3 | #include <algorithm>
+++ |+#include <iostream>
4 | using namespace std;
choosingcandies.cpp:15:21: error: ‘t’ was not declared in this scope
15 | for (int i = 0; i <t i = 0;i < n; ++i) {
| ^
choosingcandies.cpp:15:22: error: expected ‘;’ before ‘i’
15 | for (int i = 0; i <t i = 0;i < n; ++i) {
| ^~
| ;
choosingcandies.cpp:15:28: error: expected ‘)’ before ‘;’ token
15 | for (int i = 0; i <t i = 0;i < n; ++i) {
| ~ ^
| )
choosingcandies.cpp:15:2