#include "coins.h"
#include <bits/stdc++.h>
#define pii pair<int, int>
#define rep(a,b,c) for(ll a=b; a<c; a++)
#define repr(a,b,c) for(ll a=b-1; a>c-1; a--)
#define repa(a,b) for(auto a:b)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define mid ((l+r+1)>>1)
#define pb push_back
#define ll long long
#define ull unsigned ll
using namespace std;
using vi = vector<int>;
const unsigned ll y=64;
vi coin_flips(vi b, int c) {
int x=0;
rep(i,0,64) x+=(b[i]*(i+1));
rep(i,0,64){
if(b[i]) x-=((i+1));
else x+=((i+1));
if(x%y==c) return {i};
if(b[i]) x+=((i+1));
else x-=((i+1));
}
return {1};
}
int find_coin(vi b) {
int x=0;
rep(i,0,64) x+=(b[i]*(i+1));
return x%y;
}
컴파일 시 표준 에러 (stderr) 메시지
coins.cpp: In function 'vi coin_flips(vi, int)':
coins.cpp:26:36: warning: narrowing conversion of 'i' from 'long long int' to 'int' [-Wnarrowing]
26 | if(x%y==c) return {i};
| ^
coins.cpp:26:36: warning: narrowing conversion of 'i' from 'long long int' to 'int' [-Wnarrowing]
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |