結果

問題 No.791 うし数列
ユーザー nyan68682154nyan68682154
提出日時 2019-05-19 17:07:50
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 430 bytes
コンパイル時間 483 ms
コンパイル使用メモリ 60,476 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 07:56:04
合計ジャッジ時間 1,370 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<cstdio>
#include<stack>
using namespace std;
int main() {
	int n;
	cin >> n;
	int sum = 0;
	int f = 0;
	for (int i = 1; i <= n ; i = i * 10) {
		sum = sum + (n / i) % 10;
		if ((n / i) % 10 != 3) {
			if (i * 10 > n) {
				if ((n / i) % 10 == 1) {
					cout << (sum - 1) / 3;
					break;
				}
			}
			cout << -1;
			break;
		}
	}
}
0