제출 #1128808

#제출 시각아이디문제언어결과실행 시간메모리
1128808JohanChessboard (IZhO18_chessboard)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h> using namespace std; # define ld long double # define lld long long double # define endl "\n" const int mod = 1e9 + 7; const int maxn = 1e5 + 6; template < typename T > void print(vector < T > x){ for(auto i : x) cout << i << ' '; cout << endl;} template < typename T > T ceil(T a, T b){ if(a % b == 0){return a / b;} else{return a / b + 1;}} template < typename T > T floor(T a, T b){ if(a % b == 0){return a / b;} else{return a / b + 0;}} template < typename T > T lcm(T a, T b){ return (a * b) / gcd(a, b);} int combine(int a, int b, int n){ if(n == 1){return a + b;} if(n == 2){return a - b;} if(n == 3){return gcd(a, b);} if(n == 4){return lcm(a, b);} if(n == 5){return max(a, b);} if(n == 6){return min(a, b);} } template < typename T > T dis(T x1, T y1, T x2, T y2){ return (sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))); } template < typename T > T SUM(vector < T > x){ int ans = 0; for(auto i : x) ans = abs(ans + i); return ans; } template < typename T > T power(T a, T n, T m){ if(n == 0) return 1; if(n % 2 == 0) return power(((a % m) * (a % m)) % m , n / 2, m); return ((a % m) * power(a, n - 1, m)) % m; } void solve() { int n, k; cin >> n >> k; if(n & 1 || n % 6 != 0){ cout << (n * n) / 2 << endl; return ; } cout << (n * n) / 2 - pow(4, n / 6) << endl; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int tt = 1; // cin >> tt; while(tt--){ solve(); } }

컴파일 시 표준 에러 (stderr) 메시지

chessboard.cpp: In function 'int combine(int, int, int)':
chessboard.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type]
   22 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...