Compile Error

foo.cc: In function ‘int main()’:
foo.cc:6:28: error: ‘n’ was not declared in this scope
    6 |         for(int i=1;i++;i<=n;i++)
      |                            ^
foo.cc:6:29: error: expected ‘)’ before ‘;’ token
    6 |         for(int i=1;i++;i<=n;i++)
      |            ~                ^
      |                             )
foo.cc:6:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
    6 |         for(int i=1;i++;i<=n;i++)
      |         ^~~
foo.cc:6:30: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
    6 |         for(int i=1;i++;i<=n;i++)
      |                              ^
foo.cc:6:30: error: ‘i’ was not declared in this scope
foo.cc:11:36: error: expected ‘;’ before ‘return’
   11 |         cout<<a[0]/2+min(a[1],a[2])
      |                                    ^
      |                                    ;
   12 |         return 0;
      |         ~~~~~~                      

信息

递交者
类型
递交
题目
P2950 分糖果
比赛
2025.7.16中级班练习
语言
C++
递交时间
2025-07-17 09:27:29
评测时间
2025-07-17 12:51:53
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes