結果

問題 No.18 うーさー暗号
ユーザー cww
提出日時 2016-07-31 16:02:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 535 bytes
コンパイル時間 1,636 ms
コンパイル使用メモリ 169,908 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-07 06:12:39
合計ジャッジ時間 2,156 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
using namespace std;
struct btk{btk(){ios::sync_with_stdio(false);cin.tie(0);}}btk;
int main()
{
	string S;
	cin >> S;

	const string T{"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
	vector<int> vc;
	REP( i, (int)S.size() )
	{
		vc.push_back( T.find( S[i] ) );
	}
	int N{1};
	REP( i, (int)S.size() )
	{
		cout << ( vc[i] - N < 0 ? T[ 26 - abs( vc[i] - N ) ] : T[ vc[i] - N ] );
		N++;
		if( N == 26 ) N = 0;
	}
	cout << endl;
	return 0;
}
0