求大佬解释为什么开了O2优化能把我所有的WA变成AC

P2911 [USACO08OCT] Bovine Bones G

神仙代码
by ylxmf2020 @ 2018-07-24 07:04:12


markdown了解一下
by cszmc2004 @ 2018-07-24 08:45:18


@[newworld](/space/show?uid=35490) +1
by smallfang @ 2018-08-18 08:23:38


``` #include <iostream> #include <limits> #include <cstdio> #include <math.h> #include <iomanip> #include <algorithm> using namespace std; int main() { int a, b, c, d, e, f, g; int count[100] = { 0 }; cin >> a >> b >> c; for (d = 1; d <= a; d++) { for (e = 1; e <= b; e++) { for (f = 1; f <= c; f++) { g = d + e + f; count[g]++; } } } int h=1, i=0; for (h = 1; h <= 100; h++) { if (count[h] >= i) { i = count[h]; } } for (h = 1; h <= 100; h++) { if (count[h] == i) { cout << h << endl; break; } } return 0; }```
by XLao @ 2018-09-24 09:38:54


|