diff --git a/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/arrayRecovery.cpp b/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/arrayRecovery.cpp new file mode 100644 index 00000000..17d309ba --- /dev/null +++ b/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/arrayRecovery.cpp @@ -0,0 +1,60 @@ +#include +using namespace std; + +#define ll long long +#define lli long long int +#define ld long double +#define pb push_back + +ll mod = 1e9 + 7; + +ll gcd(ll firstNumber, ll secondNumber) { + if (secondNumber == 0) return firstNumber; + else return gcd(secondNumber, firstNumber % secondNumber); +} + + +// CODE START + +void solveITcaptain() { + int n; + cin>>n; + vector d(n, 0), a(n, 0); + for(int i=0; i>d[i]; + } + + a[0] = d[0]; + for(int i=1; i=0 && two >= 0) { + // cout<> t; + while (t--) { + solveITcaptain(); + } + return 0; +} \ No newline at end of file diff --git a/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/arrayRecovery.exe b/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/arrayRecovery.exe new file mode 100644 index 00000000..adf9ed53 Binary files /dev/null and b/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/arrayRecovery.exe differ diff --git a/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/cardGame.cpp b/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/cardGame.cpp new file mode 100644 index 00000000..bb51faae --- /dev/null +++ b/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/cardGame.cpp @@ -0,0 +1,79 @@ +#include +using namespace std; + +#define ll long long +#define lli long long int +#define ld long double +#define pb push_back + +ll mod = 998244353; +// CODE START + +ll NCR(ll num, ll re) { + ll p = 1, k = 1; + if (num - re < re) + re = num - re; + if (re != 0) { + while (re) { + p *= num; + k *= re; + long long m = __gcd(p, k); + p /= m; + k /= m; + num--; + re--; + } + } + + else + p = 1; + return p; +} + +void helper(int i, vector>& dp) { + if (i == 2) { + return; + } + + helper(i - 2, dp); + + dp[i][0] = (NCR(i - 1, i / 2) + dp[i - 2][1]) % mod; + dp[i][1] = (NCR(i - 2, i / 2) + dp[i - 2][0]) % mod; + dp[i][2] = (dp[i - 2][2]) % mod; +} + +void solveITcaptain() { + int n; + cin >> n; + // Sequence of Turns: Alex Boris Boris Alex Alex Boris Boris Alex + vector> dp(n + 1, vector(3, -1)); + // Alex Wins + dp[2][0] = 1; + // Boris Wins + dp[2][1] = 0; + // Draw + dp[2][2] = 1; + + // helper(n, dp); + for(int i=4; i<=n; i+=2) { + dp[i][0] = (NCR(i - 1, i / 2) + dp[i - 2][1]) % mod; + dp[i][1] = (NCR(i - 2, i / 2) + dp[i - 2][0]) % mod; + dp[i][2] = (dp[i - 2][2]) % mod; + } + + cout << dp[n][0] << " " << dp[n][1] << " " << dp[n][2] << "\n"; +} + +// CODE END + + +int main() { + system("cls"); + ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); + int t = 1; + cin >> t; + while (t--) { + solveITcaptain(); + } + return 0; +} \ No newline at end of file diff --git a/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/cardGame.exe b/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/cardGame.exe new file mode 100644 index 00000000..c95deb86 Binary files /dev/null and b/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/cardGame.exe differ diff --git a/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/chessboard.cpp b/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/chessboard.cpp new file mode 100644 index 00000000..810be30f --- /dev/null +++ b/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/chessboard.cpp @@ -0,0 +1,46 @@ +#include +using namespace std; + +#define ll long long +#define lli long long int +#define ld long double +#define pb push_back + +ll mod = 1e9 + 7; + +ll gcd(ll firstNumber, ll secondNumber) { + if (secondNumber == 0) return firstNumber; + else return gcd(secondNumber, firstNumber % secondNumber); +} + + +// CODE START + +void solveITcaptain() { + int n, m; + cin >> n >> m; + + if (n == 1 || m == 1) { + cout << n << " " << m << "\n"; + } + else if (n <= 3 && m <= 3) { + cout<> t; + while (t--) { + solveITcaptain(); + } + return 0; +} \ No newline at end of file diff --git a/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/chessboard.exe b/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/chessboard.exe new file mode 100644 index 00000000..21760d89 Binary files /dev/null and b/Codeforces/09_29_Educational Codeforces Round 136 (Rated for Div. 2)/chessboard.exe differ