結果

問題 No.3195 Three-Letter Acronym
コンテスト
ユーザー vjudge1
提出日時 2025-12-06 01:42:54
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 494 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 287 ms
コンパイル使用メモリ 26,800 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-12-06 01:42:55
合計ジャッジ時間 1,388 ms
ジャッジサーバーID
(参考情報)
judge6 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:5: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     fgets(str,sizeof(str),stdin);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

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

int main(void) {
    char str[10001];
    fgets(str,sizeof(str),stdin);
    str[strcspn(str,"\n")] = '\0';
    int n = strlen(str);
    char output[100];
    int j = 1;
    if(n>=1){
      output[0] = str[0]-32;
    }
    else{
      j = 0;
    }
    for (int i = 0; i < n; i++){
        if(str[i]==' '){
          output[j++] = str[i+1] - 32;
        }
    }
    output[j] = '\0';
    printf("%s",output);
    
    
    return 0;
}

0