結果

問題 No.671 1000000007
コンテスト
ユーザー N/A
提出日時 2018-08-28 17:41:34
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 190 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 146 ms
コンパイル使用メモリ 28,712 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-08 16:18:01
合計ジャッジ時間 624 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:17: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[17]’ [-Wformat=]
    9 |         scanf("%s", &n);
      |                ~^   ~~
      |                 |   |
      |                 |   char (*)[17]
      |                 char *
main.c:10:38: warning: ‘abs’ argument 1 promotes to ‘size_t’ {aka ‘long unsigned int’} where ‘int’ is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
   10 |         printf("%d\n", abs(strlen(n) - 10));
      |                            ~~~~~~~~~~^~~~
<built-in>: note: built-in ‘abs’ declared here
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%s", &n);
      |         ^~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <math.h>

int main(void) {
	char n[17];

	scanf("%s", &n);
	printf("%d\n", abs(strlen(n) - 10));

	return 0;
}
0