結果
| 問題 |
No.438 Cwwプログラミング入門
|
| コンテスト | |
| ユーザー |
kurenai3110
|
| 提出日時 | 2016-10-29 00:23:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 889 bytes |
| コンパイル時間 | 775 ms |
| コンパイル使用メモリ | 66,964 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-24 22:32:06 |
| 合計ジャッジ時間 | 12,626 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 26 WA * 67 RE * 5 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <cstdlib>
using namespace std;
typedef long long ll;
ll FIB[61];
ll gcd(ll a, ll b) {
while (a) {
b %= a;
swap(a, b);
}
return b;
}
int main()
{
FIB[1] = 1; FIB[2] = 1;
for (int i = 3; i < 61; i++)FIB[i] = FIB[i - 1] + FIB[i - 2];
ll x, y, z; cin >> x >> y >> z;
if (z%gcd(x, y)) {
cout << "mourennaihasimasenn" << endl;
return 0;
}
pair<int, int>ans;
for (int i = 1; i <60; i++) {
if ((z-x*FIB[i]) % y == 0) {
if (abs(x*FIB[i] + y * FIB[i + 1] - z) / y < 4000) {
ans = make_pair(i, (z-(x*FIB[i] + y * FIB[i + 1])) / y);
break;
}
}
}
cout << "cw";
for (int i = 0; i < ans.first; i++)cout << "C";
for (int i = 0; i < abs(ans.second); i++) {
cout << "w";
if (ans.second>0)cout << "C";
else cout << "W";
}
cout << endl;
return 0;
}
kurenai3110