結果
| 問題 |
No.2868 Another String of yuusaan
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-28 08:15:09 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 887 bytes |
| コンパイル時間 | 3,051 ms |
| コンパイル使用メモリ | 247,284 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-08 23:14:10 |
| 合計ジャッジ時間 | 3,714 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
コンパイルメッセージ
main.cpp: In function 'int slove(int, long long int)':
main.cpp:25:1: warning: control reaches end of non-void function [-Wreturn-type]
25 | }
| ^
ソースコード
#include<bits/stdc++.h>
using namespace std;
vector<long long> len(26,1);
long long N,K;
int slove(int lv,long long count){
for(int j = 0;j < 7;j++){
if(j == 0 || j == 3 || j == 6 || lv == 1){
count++;
}
else{
if(count + len[lv-1] < K){
count += len[lv - 1];
}
else{
return slove(lv-1,count);
}
}
if(count == K){
return j;
}
}
}
int main(){
long long nowlen = 8;
for(int j = 1;j <= 25;j++){
len[j] = nowlen - 1;
nowlen *= 4;
}
cin >> N >> K;
if(N > 25){
if(N >= K){
cout << "y" << endl;
return 0;
}
K -= N - 25;
N = 25;
}
int ans = slove(N,0);
cout << string("yuusaan").substr(ans,1) << endl;
return 0;
}