結果

問題 No.485 方程式のお勉強
ユーザー こるこる
提出日時 2017-02-24 22:26:42
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,904 bytes
コンパイル時間 651 ms
コンパイル使用メモリ 85,420 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 22:50:47
合計ジャッジ時間 1,518 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 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,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 1 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<algorithm>
#include<queue>
#include<functional>
#include<numeric>
#include<sstream>
#include<math.h>
#include <iomanip>
#define ll long long
#define PLL pair<ll,ll>
#define VS vector<string>
#define VL vector<ll>
#define VB vector<bool>
#define VPLL vector<pair<ll,ll> >
#define VVL vector<vector<ll> >
#define VVVL vector<vector<vector<ll> > >
#define VVB vector<vector<bool> >
#define rep(i,a) for (ll i=0;i<a;i++)
#define nrep(i,n,a) for (ll i=n;i<a;i++)
#define mrep(i,a) for(ll i=a;i>=0;i--)
#define INF 1000000000000000000
#define PI 3.141592653589793238
#define vmin(vec) *std::min_element(vec.begin(),vec.end())
#define vmax(vec) *std::max_element(vec.begin(),vec.end())
#define vsum(vec) std::accumulate(vec.begin(),vec.end(),0LL)
#define ksort(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define ssort(vec) (vec.begin(),vec.end())
#define VPLLsort(vec) sort(vec.begin(), vec.end(),[](PLL &a, PLL &b){ return a.first < b.first; });
#define LTS(n) to_string(n)
#define STL(str) stoll(str)
using namespace std;

ll n, W, V;

ll dfs(VVL &dp, VL &v, VL &w, ll index, ll weight){
	if (index == n) return 0;
	if (weight > W) return 0;
	if (dp[index][weight] != -1) return dp[index][weight];
	if (weight + w[index] <= W){
		return dp[index][weight] = max(dfs(dp, v, w, index + 1, weight + w[index]) + v[index], dfs(dp, v, w, index + 1, weight));
	}
	else{
		return dp[index][weight] = dfs(dp, v, w, index + 1, weight);
	}
}

ll dfs(VL &v, VL &w, ll index, ll weight){
	if (index == n) return 0;
	if (weight > W) return 0;
	if (weight + w[index] <= W){
		return max(dfs(v, w, index + 1, weight + w[index]) + v[index], dfs(v, w, index + 1, weight));
	}
	else{
		return dfs(v, w, index + 1, weight);
	}
}


int main() {
	ll a, b;
	cin >> a >> b;
	if (b%a == 0) cout << b / a << endl;
	else cout << "NO" << endl;
	return 0;
}
0