Submission #652631

#TimeUsernameProblemLanguageResultExecution timeMemory
652631BidoTeimaKotrljanje (COCI18_kotrljanje)C++17
0 / 140
111 ms2584 KiB
/* ID: BidoTeima LANG: C++11 TASK: Izbori */ #include <bits/stdc++.h> using namespace std; using ll = long long; void moo(string filename); void ACPLS(string str = "") { if(str=="NOF")return; if(str.size()) moo(str); else{ #ifndef ONLINE_JUDGE freopen("output.txt", "w", stdout); freopen("input.txt", "r", stdin); #endif } ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } void moo(string fileName){ freopen((fileName+".in").c_str(),"r",stdin); freopen((fileName+".out").c_str(),"w",stdout); } #define tc \ int tttttt/*,subtask*/; \ cin >> tttttt/* >> subtask*/; \ while (tttttt--)/*end */ ll sodB(ll x, ll B){ ll ret = 0; while(x){ ret+=x%B; x/=B; } return ret; } int main() { //ACPLS(""); ll C,D,B,M; cin>>C>>D>>B>>M; ll start = -1, diff = 0; for(int s = 1; s <= 1e4; s++){ for(int d = 1; d <= 5000; d++){ ll sumdigits = sodB(C*s+D,B); if(sumdigits == sodB(C*(s+d)+D,B)){ ll lstN = s+d*(M-1); if(sumdigits==sodB(C*lstN+D,B)){ start = s, diff = d; } break; } } if(start != -1)break; } while(M--){ cout<<start<<' '; start+=diff; } cout<<'\n'; }

Compilation message (stderr)

kotrljanje.cpp: In function 'void ACPLS(std::string)':
kotrljanje.cpp:17:20: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |             freopen("output.txt", "w", stdout);
      |             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
kotrljanje.cpp:18:20: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |             freopen("input.txt", "r", stdin);
      |             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
kotrljanje.cpp: In function 'void moo(std::string)':
kotrljanje.cpp:26:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |     freopen((fileName+".in").c_str(),"r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kotrljanje.cpp:27:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |     freopen((fileName+".out").c_str(),"w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...