結果

問題 No.2224 UFO Game
ユーザー Maeda
提出日時 2025-03-18 18:00:06
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 402 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 26,112 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-18 18:00:07
合計ジャッジ時間 1,408 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:16:27: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘long long int’ [-Wformat=]
   16 |                 printf("%ld",result);
      |                         ~~^  ~~~~~~
      |                           |  |
      |                           |  long long int
      |                           long int
      |                         %lld
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%s",score);
      |         ^~~~~~~~~~~~~~~~~

ソースコード

diff #

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

void main(void){
	char score[100] = "a";
	scanf("%s",score);
	if(score[0] != 'x'){
		printf("%s",score);
	}else{
		char decision[100] = "a";
		strncpy(decision, score+1,(int)strlen(score)-1 );
		decision[(int)strlen(score)-1] = '\0';
		int scoreNum = atoi(decision);
		long long int result = 4294967296-scoreNum;
		printf("%ld",result);
	}
}
0