結果

問題 No.575 n! / m / m / m...
ユーザー ryoissy
提出日時 2017-10-07 14:49:20
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 460 bytes
コンパイル時間 1,360 ms
コンパイル使用メモリ 157,528 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-17 04:26:56
合計ジャッジ時間 4,070 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%lld%lld",&n,&m);
      |         ~~~~~^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll n,m;
double ume[1001]={};

int main(void){
	scanf("%lld%lld",&n,&m);
	ll cnt=0;
	ll np=n;
	while(np>=m){
		cnt+=np/m;
		np/=m;
	}
	long double sum=lgammal(n+1LL);
	sum/=log(10);
	long double nex=log10l(m);
	sum-=(long double)nex*cnt;
	ll resp=sum;
	double rest=(long double)sum-resp;
	printf("%.5fe%lld\n",pow(10,rest),resp);
	return 0;
}
0