結果
| 問題 | No.587 七対子 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-04-11 04:05:03 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 313 bytes | 
| コンパイル時間 | 1,918 ms | 
| コンパイル使用メモリ | 192,900 KB | 
| 最終ジャッジ日時 | 2025-01-09 17:12:30 | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 35 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:26: warning: format ‘%c’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
   12 |                 printf("%c\n",find(hist,hist+128,1)-hist);
      |                         ~^    ~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                          |                         |
      |                          int                       long int
      |                         %ld
            
            ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
	string s; cin>>s;
	int hist[128]={};
	for(char c:s) hist[c]++;
	if(count(hist,hist+128,1)==1 && count(hist,hist+128,2)==6){
		printf("%c\n",find(hist,hist+128,1)-hist);
	}
	else puts("Impossible");
	return 0;
}
            
            
            
        