結果

問題 No.1229 ラグビーの得点パターン
ユーザー hisataka7hisataka7
提出日時 2020-11-30 18:53:26
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 2,572 bytes
コンパイル時間 1,653 ms
コンパイル使用メモリ 168,816 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-11 02:58:28
合計ジャッジ時間 2,813 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,372 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 3 ms
4,352 KB
testcase_09 AC 2 ms
4,352 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 3 ms
4,348 KB
testcase_12 AC 2 ms
4,356 KB
testcase_13 AC 3 ms
4,352 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,352 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,352 KB
testcase_21 AC 2 ms
4,352 KB
testcase_22 AC 3 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,352 KB
testcase_28 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define reps(i,n) for(ll i=1;i<ll(n);i++)
#define rrep(i,n) for(ll i=ll(n);i>=0;i--)
#define ALL(x) x.begin(),x.end()
#define FOR(i,a,b) for(ll i=a;i<=b;i++)//使いにくかったら消す
#define len(x) x.length()//配列の長さ
#define SIZE(x) x.size()//vectorのサイズ
#define NPOS string::npos//findで検索失敗した場合の戻り値(findは文字列内に特定の文字列があるかを判定)
typedef long long ll;
using namespace std;
const ll INF=1LL<<60;//無限大
ll ans=0;            //解答用の変数

bool comp_len(const std::string &lh,const std::string &rh){return lh.length() < rh.length();}  //文字列を長さでソートする時の比較関数
ll gcd(ll a, ll b) {if (b==0) return a;else return gcd(b, a%b);}                               //最大公約数
ll lcm(ll a, ll b) {return a * b / gcd(a, b);}                                                 //最小公倍数
ll digit_sum(ll a,ll b){ll ans=0;while(a>0){ans+=a%b;a/=b;}return ans;}                        //n進桁和
ll digit_num(ll a,ll b){ll ans=0;while(a>0){ans++;a/=b;}return ans;}                           //n進桁数
ll fact(ll n){if(n==1)return 1;else return n*fact(n-1);}                                       //階乗
ll array_sum(ll *a,ll n){ll ans=0;rep(i,n){ans+=a[i];}return ans;}                             //配列総和
ll combi(ll n, ll k){if(n==k||k==0){return 1;}else{return combi(n-1,k-1)+combi(n-1,k);}}       //nCkの組み合わせ
bool is_prime(ll x){for(ll i=2;i*i<=x;i++){if(x%i==0)return false;}return true;}               //素数判定
// for(long long i=1;i*i<= n;i++){if(n%i==0){ans.push_back(i);if(i*i!=n)ans.push_back(n/i);}}  //約数列挙(vector型の変数の用意が必要)

/*dp(動的計画法)*/
template <typename T>bool chmax(T &a, const T& b){if(a<b){a=b;return true;}return false;}//a<bならaをbに置き換え
template <typename T>bool chmin(T &a, const T& b){if(a>b){a=b;return true;}return false;}//a>bならaをbで置き換え

/*Union-Find(素集合データ構造)*/
vector<ll> par(100010);//親の値を保持
ll root(ll x){if(par[x]==x){return x;}else{return par[x]=root(par[x]);}}//根の値を返す
bool same(ll x,ll y){return (root(x)==root(y));}//根が一致しているか判定
void unite(ll x,ll y){x=root(x);y=root(y);if(x==y)return;par[x]=y;}//グループを併合


int main()
{
  ll n;
  cin>>n;
  rep(i,n/5+1){
    rep(j,n/2+1){
      rep(k,n/3+1)
      if(5*i+2*j+3*k==n&&j<=i)ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}
0