結果
問題 |
No.438 Cwwプログラミング入門
|
ユーザー |
![]() |
提出日時 | 2025-01-11 13:10:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 720 bytes |
コンパイル時間 | 483 ms |
コンパイル使用メモリ | 36,224 KB |
実行使用メモリ | 13,764 KB |
最終ジャッジ日時 | 2025-01-11 13:10:46 |
合計ジャッジ時間 | 20,156 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 93 RE * 4 TLE * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:10: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | freopen("code.out","w",stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ main.cpp:7:19: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | int x,y,z; scanf("%d %d %d",&x,&y,&z); | ~~~~~^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<cstdio> #include<cmath> using namespace std; int main() { //freopen("code.in","r",stdin); freopen("code.out","w",stdout); int x,y,z; scanf("%d %d %d",&x,&y,&z); if(!z) return printf("ccW"),0; for(int a=-10000;a<=10000;a++) { int b=(z-1ll*a*x)/y,t=a; if(1ll*a*x+1ll*b*y!=z||2*(abs(a)+abs(b))-1>10000) continue; if(a>=0&&b>=0) { printf("c"); while(--a) printf("cC"); while(b--) printf("wC"); return 0; } if(a>=0&&b<=0) { printf("c"); while(--a) printf("cC"); b=-b; while(b--) printf("wW"); return 0; } if(a<=0&&b>=0) { printf("w"); while(--b) printf("wC"); a=-a; while(a--) printf("cW"); return 0; } a=t; } printf("NO"); return 0; }