結果

問題 No.639 An Ordinary Sequence
ユーザー YSD_Ryoga
提出日時 2018-01-27 12:04:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 307 bytes
コンパイル時間 1,624 ms
コンパイル使用メモリ 161,096 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-02 02:16:02
合計ジャッジ時間 2,106 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |         scanf("%lld", &n);
      |         ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long

map<int, int> mp;
int solve(int n){
	if(mp[n] != 0)return mp[n];
	if(n == 0)return 1;
	mp[n] = solve(n/3) + solve(n/5);
	return mp[n];
}

signed main(){
	int n;
	scanf("%lld", &n);
	int ans = solve(n);
	printf("%lld\n", ans);
	return 0;
}
0