結果

問題 No.485 方程式のお勉強
ユーザー こる
提出日時 2017-02-24 22:26:42
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,904 bytes
コンパイル時間 734 ms
コンパイル使用メモリ 86,268 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-04 03:27:00
合計ジャッジ時間 1,399 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0