結果

問題 No.1532 Different Products
ユーザー tails
提出日時 2021-06-04 21:51:21
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 330 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 49,280 KB
実行使用メモリ 8,832 KB
最終ジャッジ日時 2024-11-19 13:53:36
合計ジャッジ時間 16,280 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 WA * 44
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:19: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         std::scanf("%d",&n);
      |         ~~~~~~~~~~^~~~~~~~~
main.cpp:7:19: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         std::scanf("%d",&k);
      |         ~~~~~~~~~~^~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <map>

int main(){
	int n,k;
	std::scanf("%d",&n);
	std::scanf("%d",&k);
	std::map<int,long> h;
	h[k]=1;
	for(int i=n;i>=2;--i){
		std::map<int,long> d=h;
		for(auto v:h){
			int a=v.first/i;
			d[a]+=v.second;
		}
		h=d;
	}
	h[0]=0;
	long t=0;
	for(auto v:h){
		t+=v.second;
	}
	printf("%ld",t*2-1);
}
0