제출 #1185722

#제출 시각아이디문제언어결과실행 시간메모리
1185722islam_2010버섯 세기 (IOI20_mushrooms)C++20
0 / 100
50 ms420 KiB
#include <bits/stdc++.h> #include "mushrooms.h" using namespace std; int count_mushrooms(int n) { int ans = 1; int i = 1; while ( i <= n){ if(i>=n){ break; } int a = use_machine({0, i, i+1}); if(a==0){ ans += 2; }else if(a==1){ int b = use_machine({0, i}); if(b==0){ ans++; } }else { ans++; } }if(n%2==1){ int c = use_machine({0, n-1}); if(c==0){ ans++; } }return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...