結果

問題 No.267 トランプソート
ユーザー Bantako
提出日時 2017-07-26 12:45:14
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 389 bytes
コンパイル時間 1,276 ms
コンパイル使用メモリ 159,236 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-09 17:43:47
合計ジャッジ時間 2,075 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%d%*c",&N);
      |     ~~~~~^~~~~~~~~~~~
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%c%c%*c",&a,&b);
      |         ~~~~~^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<bits/stdc++.h>
int card[52];
main(){
    int N;
    scanf("%d%*c",&N);
    char c[] = "DCHS";
    char n[] = "A23456789TJQK";
    for(int i = 0;i < N;i++){
        char a,b;
        scanf("%c%c%*c",&a,&b);
        card[(strchr(c,a)-c)*13+(strchr(n,b)-n)] = 1;
    }
    for(int i = 0;i < 52;i++){
        if(card[i]){
            printf("%c%c ",c[i/13],n[i%13]);
        }
    }
}
0