結果

問題 No.83 最大マッチング
ユーザー nyro2
提出日時 2018-01-17 09:24:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 597 bytes
コンパイル時間 454 ms
コンパイル使用メモリ 54,648 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 06:38:55
合計ジャッジ時間 3,410 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdlib>

int mypow(int num, int times) {
    int ans = 1;
    
    if (times == 0)
        return 1;
    
    for (int i=0; i<times; i++) {
        ans *= num;
    }
    
    return ans;
}

int main()
{
    int num;
    int i;
    int ans = 0;
    std::cin >> num;

    if (num % 2 == 0) {
        num /= 2;
        for (i=1; i<=num; i++) {
            ans += mypow(10, i-1);
        }
    } else {
        num /= 2;
        for (i=1; i<=num; i++) {
            ans += mypow(10, i-1);
        }
        ans += (i-1)*6;
    }
    
    std::cout << ans << std::endl;
}
0