結果
問題 |
No.536 人工知能
|
ユーザー |
![]() |
提出日時 | 2025-03-10 14:44:19 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 368 bytes |
コンパイル時間 | 314 ms |
コンパイル使用メモリ | 25,344 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-10 14:44:20 |
合計ジャッジ時間 | 1,389 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%s",name); | ^~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> void main(void){ char name[1000] = "a"; char decision[1000] = "a"; scanf("%s",name); strncpy(decision, name+((int)strlen(name)-2), 2); if(strcmp(decision,"ai") != 0){ printf("%s-AI",name); }else{ memset(decision, '\0', sizeof(decision)); strncpy(decision, name, (int)strlen(name)-2); printf("%sAI",decision); } }