結果

問題 No.188 HAPPY DAY
ユーザー Eclair1015Eclair1015
提出日時 2018-07-08 13:42:25
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 60,148 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-21 08:41:23
合計ジャッジ時間 825 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>

#define INT_MAX 2147483647
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int func(int n);
using namespace std;
int main() {
	int sum;
	int count = 0;

	for (int i = 1; i < 13; i++) {
		for (int j = 1; j < 32; j++) {

			if (j > 9) sum = func(j);
			else sum = j;

			if (sum == i) count++;
		}
	}
	cout << count << endl;
}

int func(int n) {
	int sum=0;
	if (n < 10) {
		return n;
	} else {
		while (n >= 10) {
			sum += n % 10;
			n /= 10;
		}
		return sum;
	}
}
0