結果

問題 No.405 ローマ数字の腕時計
ユーザー iroha168iroha168
提出日時 2017-01-14 00:19:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 797 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 93,276 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 18:24:43
合計ジャッジ時間 1,709 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 WA -
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
4,380 KB
testcase_21 WA -
testcase_22 AC 1 ms
4,380 KB
testcase_23 WA -
testcase_24 AC 2 ms
4,376 KB
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
using namespace std;
int x[100000];
int main() {
	string s, t="";
	int n,c=0;
	cin >> s >> n;
	if (s == "IX") {
		c = 9;
	}
	else {
		for (int i = 0; i < s.length(); i++) {
			if (s[i] == 'I') c++;
			else if (s[i] == 'V')c += 5;
			else c += 10;
		}
	}
	if (n >= 0) {
		c = (c + n) % 13;
	}
	else {
		n = n % 24;
		c = (c + n <= 0) ? 12 + (c + n) : c + n;
	}
	if (c  == 9) {
		cout << "IX" << endl;
	}
	else {
		if (c >= 10) {
			cout << "X";
			c -= 10;
		}
		else if( c >= 5 ) {
			cout << "V";
			c -= 5;

		}
		while (c) {
			cout << "I";
			c--;
		}
	}
	cout << endl;
	return 0;
}
0