Created
November 6, 2020 15:27
-
-
Save recuraki/a5b843493ed3d0623033e48506d1ef50 to your computer and use it in GitHub Desktop.
supercon2002_yosen.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
#define ALL(x) (x).begin(), (x).end() | |
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++) | |
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--) | |
#define REP(i, n) FOR(i,0,n) | |
#define IREP(i, n) IFOR(i,0,n) | |
////////////////////////////////////// | |
#include <iostream> | |
using namespace std; | |
#define dp(arg) do { cout << #arg << ":"; dprint(arg); } while(0) | |
template <typename T> void dprint(T arg) { cout << arg << "\n"; } | |
template <typename T> void dprint(const vector<T>& arg) { for_each(begin(arg), end(arg), [](T value){ cout << value << " "; } ); cout << "\n"; } | |
template <typename T> void dprint(const vector<vector<T>>& arg) { for_each(begin(arg), end(arg), [=](vector<T> arg2){ dprint(arg2); cout << "\n";} ); } | |
////////////////////////////////////// | |
#define ll long long int | |
// sigma 1 to n | |
ll sigma1(ll n){ | |
return n*(n+1)/2; | |
} | |
int main(int argc, char *argv[]) { | |
int keta1[500][500]; | |
int keta2[500][500]; | |
int x; | |
REP(i, 500) REP(j, 500){ keta1[i][j] = 0; keta2[i][j] = 0; } | |
REP(i, 500) { keta1[0][i] = i; keta1[1][i] = i+1; } | |
FOR(nn, 2, 200) FOR(mm, 2, 200){ | |
x = keta1[nn-1][mm+1] + (keta1[nn-2][mm+2] / 2); | |
x += keta2[nn-2][mm+2]%2 ? 500000000 : 0; | |
keta1[nn][mm] = x % 1000000000; | |
keta2[nn][mm] = x / 1000000000 + (keta2[nn-1][mm+1] + keta2[nn-2][mm+2] / 2); | |
} | |
cout << keta1[35][35] << endl; | |
cout << keta2[70][70] << setfill('0') << setw(8) << keta1[70][70] << endl; | |
cout << keta2[100][100] << setfill('0') << setw(8) << keta1[100][100] << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment