結果

問題 No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
ユーザー kotatsugamekotatsugame
提出日時 2021-11-05 21:32:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 585 bytes
コンパイル時間 633 ms
コンパイル使用メモリ 71,300 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-24 05:18:48
合計ジャッジ時間 1,260 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 1 ms
6,944 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 1 ms
6,940 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<map>
using namespace std;
string N;
int T[1<<17];
main()
{
	cin>>N;
	int mx=0;
	for(int i=0;i<N.size();i++)
	{
		int c=N[i]-'A'+10;
		int n=N.size()-i-1;
		n*=4;
		c<<=n%3;
		n/=3;
		while(c>0)
		{
			T[n]+=c%8;
			if(mx<n)mx=n;
			c/=8;
			n++;
		}
	}
	int cnt[8]={};
	int mxc=0;
	for(int i=0;i<=mx;i++)
	{
		if(T[i]>=8)
		{
			T[i+1]+=T[i]/8;
			T[i]%=8;
			if(mx<i+1)mx=i+1;
		}
		cnt[T[i]]++;
		if(mxc<cnt[T[i]])mxc=cnt[T[i]];
	}
	int z=0;
	for(int i=0;i<8;i++)if(cnt[i]==mxc)z++;
	for(int i=0;i<8;i++)if(cnt[i]==mxc)
	{
		cout<<i<<(--z?" ":"\n");
	}
}
0