結果
| 問題 | 
                            No.294 SuperFizzBuzz
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tokkaka
                         | 
                    
| 提出日時 | 2016-07-18 16:39:33 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 81 ms / 5,000 ms | 
| コード長 | 926 bytes | 
| コンパイル時間 | 821 ms | 
| コンパイル使用メモリ | 95,572 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-15 16:58:53 | 
| 合計ジャッジ時間 | 2,110 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 12 | 
ソースコード
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <functional>
#include <tuple>
#include <climits>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <iomanip>
using namespace std;
int main()
{
    string number = "53";
    int N;
    cin >> N;
    int n = 0;
    int sum = 8;
    while(n!=N) {
        int index = 1;
        while(true) {
            if(index>=number.size()) {
                number += '3';
                sum += 3;
                break;
            }
            if(number[index]=='3') {
                number[index] = '5';
                sum += 2;
                break;
            }
            number[index] = '3';
            sum -= 2;
            index++;
        }
        if(sum % 3 == 0) {
            n++;
        }
    }
    reverse(number.begin(), number.end());
    cout << number << endl;
}
            
            
            
        
            
tokkaka