結果
| 問題 | No.544 Delete 7 |
| コンテスト | |
| ユーザー |
くれちー
|
| 提出日時 | 2016-12-23 01:04:16 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 462 bytes |
| 記録 | |
| コンパイル時間 | 294 ms |
| コンパイル使用メモリ | 22,784 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-23 20:28:59 |
| 合計ジャッジ時間 | 2,549 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 44 WA * 4 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:18:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <stdlib.h>
int getrand(int min, int max) {
return min + (int)(rand() * (max - min + 1.0) / (1.0 + RAND_MAX));
}
int contain7(int n) {
while (n != 0) {
if (n % 10 == 7 || n % 10 == -7) return 1;
n = (n - n % 10) / 10;
}
return 0;
}
int main() {
int n;
scanf("%d", &n);
int a, b;
while (1) {
a = getrand(-1e9, 1e9);
b = n - a;
if (!contain7(a) && !contain7(b)) break;
}
printf("%d %d\n", a, b);
return 0;
}
くれちー