結果

問題 No.170 スワップ文字列(Easy)
ユーザー 173205080173205080
提出日時 2019-07-12 09:23:07
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 463 bytes
コンパイル時間 1,330 ms
コンパイル使用メモリ 28,308 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-10 17:14:41
合計ジャッジ時間 1,426 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 0 ms
4,376 KB
testcase_02 AC 0 ms
4,384 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 0 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 0 ms
4,376 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 AC 0 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 0 ms
4,376 KB
testcase_20 AC 1 ms
4,388 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 0 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define df 0

int comp(const void*a,const void*b){
  int x=*((char*)a);
  int y=*((char*)b);
  return x-y;
}

int main(){
  char s[10];
  scanf("%s",s);
  int n=strlen(s);
  qsort(s,n,sizeof(char),comp);
  long int ans=n;
  int i,t=1;
  char pr=s[0];
  for(i=1;i<n;i++){
    ans*=n-i;
    if(pr==s[i])t++; else t=1;
    ans/=t;
    pr=s[i];
  }

  printf("%ld",ans-1);
  return 0;
}


/// confirm df==0 ///
0