結果

問題 No.558 575検出するやつ
ユーザー jokin_tokeijokin_tokei
提出日時 2017-09-12 22:32:09
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 1,931 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 33,536 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 07:11:43
合計ジャッジ時間 1,252 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define ARRAY_NUM 100000

void factorial_calc(); // No.500
void delete_7();
void check_575();
//void jenga();   //
//void poker();

int main(void) {

	check_575();

	return 0;
}

void factorial_calc() {
	int n=0, sum=0;

	scanf("%d", &n);

	sum = n;
	while (n--) {  // n回ループ
		if(n == 0){
			break;
		}
		sum *= n;
	}

	printf("%d\n", sum % (int) pow(10, 12));
}

void delete_7() {
	int n = 0, a = 0, b = 0, digit = 0;
	int i = 0;

	scanf("%d", &n);

	for (i = 0; pow(10, i) < n; i++) {
		digit = (n % (int) pow(10, i + 1)) / (int) pow(10, i);
		switch (digit) {
		case 7:
			a += 3 * pow(10, i);
			b += 4 * pow(10, i);
			break;
		case 8:
			a += 4 * pow(10, i);
			b += 4 * pow(10, i);
			break;
		case 9:
			a += 5 * pow(10, i);
			b += 4 * pow(10, i);
			break;
		default:
			a += digit * pow(10, i);
			b += 0 * pow(10, i);
		}
//		switch (digit) {
//		case 0:
//			a += 0 * pow(10, i);
//			break;
//		case 1:
//			a += 1 * pow(10, i);
//			break;
//		case 2:
//			a += 2 * pow(10, i);
//			break;
//		case 3:
//			a += 3 * pow(10, i);
//			break;
//		case 4:
//			a += 4 * pow(10, i);
//			break;
//		case 5:
//			a += 5 * pow(10, i);
//			break;
//		case 6:
//			a += 6 * pow(10, i);
//			break;
//		case 7:
//			a += 3 * pow(10, i);
//			b += 4 * pow(10, i);
//			break;
//		case 8:
//			a += 4 * pow(10, i);
//			b += 4 * pow(10, i);
//			break;
//		case 9:
//			a += 5 * pow(10, i);
//			b += 4 * pow(10, i);
//		}
//
//		if (digit < 7) {
//			b += 0 * pow(10, i);
//		}
	}

	printf("%d %d", a, b);

}

void check_575() {
	int i = 0;
	char str[100] = { };
	char str1[] = "575";
	scanf("%s", str);

	for (i = 0; i < 100; i++) {
		if (strcmp(&str1[0], &(str[i])) == 0) {
			if (strcmp(&str1[1], &(str[i + 1])) == 0) {
				if (strcmp(&str1[2], &(str[i + 2])) == 0) {
					printf("YES");
					return;
				}
			}
		}
	}

	printf("NO");
}
0