結果

問題 No.438 Cwwプログラミング入門
ユーザー butter_roll
提出日時 2016-10-29 05:02:00
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 916 bytes
コンパイル時間 687 ms
コンパイル使用メモリ 60,088 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-24 23:05:04
合計ジャッジ時間 9,024 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 57 WA * 36 RE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <typeinfo>
using namespace std;



int main(void){
  
  int i,l,r,k,t,j,tmp;
  int x,y,z;
  int a,b;
  int am,bm;

  cin>>x>>y>>z;
  a=-1;
  for(i=0;i<=5000;i++){
    if((z-i*x)%y==0) {a=i; goto L;}
  }
  for(i=0;i>=-5000;i--){
    if((z-i*x)%y==0) {a=i; break;}
  }

 L:

  b=(z-a*x)/y;
  if(a==-1||b>5000) {
    cout<<"mourennaihasimasenn"<<endl;
    return 0;
  }

  
  am=1;bm=1;
  if(a<0) am=-1;
  if(b<0) bm=-1;

  a=abs(a);  
  b=abs(b);  
  
  j=0;k=0;
  if(a!=0) {
    cout<<"c";
    j=1;
  }
  else if(b!=0) {
    cout<<"w";
    k=1;
  }
  
  for(i=1;i<2*a+2*b-1;i++){
    if(j<a){
      cout<<"c";
      if(am==-1) cout<<"W";
      else cout<<"C";
      j++;
    }
    else if(k<b){
      cout<<"w";
      if(bm==-1) cout<<"W";
      else cout<<"C";
      k++;
    }
  }
  
  cout<<endl;
  return 0;
}
0