結果
| 問題 | 
                            No.701 ひとりしりとり
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-11-24 00:10:47 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 644 bytes | 
| コンパイル時間 | 714 ms | 
| コンパイル使用メモリ | 61,756 KB | 
| 実行使用メモリ | 6,816 KB | 
| 最終ジャッジ日時 | 2024-12-24 18:56:29 | 
| 合計ジャッジ時間 | 1,714 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 WA * 1 | 
ソースコード
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
string int2a_b_string(int num){
    long ans = 0;
    for(int i=0;num>0;i++){
        ans = ans+(num%2)*pow(10,i);
        num=num/2;
    }
    string bin = to_string(ans);
    string outstr = "";
    for(int j=bin.size()-1;j>=0;j--){
        if(bin[j]=='0') outstr = "a" + outstr;
        else outstr = "b" + outstr;
    }
    return outstr;
}
int main(){
    int n;
    cin >> n;
    for(int k=0;k<n;k++){
        cout << "c";
        cout << int2a_b_string(k);
        cout << "c";
        if(k==n-1) cout << "n\n";
        else cout << "\n";
    }
    return 0;
}