結果

問題 No.717 ファッションへのこだわり
コンテスト
ユーザー subsn
提出日時 2023-06-16 10:56:27
言語 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
コード長 333 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 127 ms
コンパイル使用メモリ 30,276 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-08 16:34:56
合計ジャッジ時間 546 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:5: warning: incompatible implicit declaration of built-in function ‘memset’ [-Wbuiltin-declaration-mismatch]
    6 |     memset(u,0,8);
      |     ^~~~~~
main.c:1:1: note: include ‘<string.h>’ or provide a declaration of ‘memset’
  +++ |+#include <string.h>
    1 | main(n,m,i,ans){
main.c:8:5: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    8 |     scanf("%d%d",&n,&m);
      |     ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | main(n,m,i,ans){
main.c:9:13: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[10000]’ [-Wformat=]
    9 |     scanf("%s",&s);
      |            ~^  ~~
      |             |  |
      |             |  char (*)[10000]
      |             char *
main.c:11:13: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[10000]’ [-Wformat=]
   11 |     scanf("%s",&s);
      |            ~^  ~~
      |             |  |
      |             |  char (*)[10000]
      |             char *
main.c:14:5: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
   14 |     printf("%d",ans);
      |     ^~~~~~
main.c:14:5: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

diff #
raw source code

main(n,m,i,ans){
    ans=0;
    char s[10000];
    int u[2];
    int b[2];
    memset(u,0,8);
    memset(b,0,8);
    scanf("%d%d",&n,&m);
    scanf("%s",&s);
    for (;n--;)s[n]=='A'?u[0]++:u[1]++;
    scanf("%s",&s);
    for (;m--;)s[m]=='A'?b[0]++:b[1]++;
    for (i=2;i--;)u[i]>=b[i]?ans+=b[i]:(ans+=u[i]);
    printf("%d",ans);
}
0