Skip to content

Commit ff738bd

Browse files
committed
.
1 parent 086f6f1 commit ff738bd

19 files changed

+806
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"Guess the Number","group":"CodeChef - March Cook-Off 2021 Division 2","url":"https://www.codechef.com/COOK127B/problems/GUESSIT","interactive":true,"memoryLimit":256,"timeLimit":1000,"tests":[{"id":1616386126488,"input":"2\n0 0 0 0 1\n1","output":""}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"GuessTheNumber"}},"batch":{"id":"2b615ec6-1ac2-4100-b364-0e0fd57f297e","size":1},"srcPath":"c:\\Users\\Dhruv\\myGithub\\Competitive-Programming\\Guess_the_Number.cpp"}

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"files.associations": {
3+
"iostream": "cpp"
4+
}
5+
}

Google/KickStart Round A 2021/template.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ class Math
9090
//------------------------------------------------------------------------------
9191
void solve()
9292
{
93-
93+
9494
}
95+
9596
//------------------------------------------------------------------------------
9697
int32_t main()
9798
{

Guess_the_Number.cpp

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
2+
//------------------------------------------------------------------------------
3+
#include <iostream>
4+
#include <vector>
5+
// #include <bits/stdc++.h>
6+
#include <cmath>
7+
// #include <algorithm>
8+
// #include <unordered_map>
9+
// #include <map>
10+
// #include <set>
11+
// #include <unordered_set>
12+
//------------------------------------------------------------------------------
13+
using namespace std;
14+
//------------------------------------------------------------------------------
15+
#define FastIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
16+
#define v(Type) vector<Type>
17+
#define w(T) \
18+
int T; \
19+
cin >> T; \
20+
while (T--)
21+
#define int long long int
22+
#define mod 1000000007ll
23+
#define endl "\n"
24+
//------------------------------------------------------------------------------
25+
// Any fucntion can be called using Math.function_name();
26+
//------------------------------------------------------------------------------
27+
class Math
28+
{
29+
public:
30+
//Returns gcd of two numbers
31+
int gcd(int a, int b)
32+
{
33+
return (a % b == 0) ? b : gcd(b, a % b);
34+
}
35+
36+
//Returns lcm of two numbers
37+
int lcm(int a, int b)
38+
{
39+
return a * (b / gcd(a, b));
40+
}
41+
42+
// Returns flag array isPrime
43+
// isPrime[i] = true (if i is Prime)
44+
// isPrime[i] = false (if i is not Prime)
45+
vector<bool> *seiveOfEratosthenes(const int N)
46+
{
47+
vector<bool> *isPrime = new vector<bool>(N + 1, true);
48+
(*isPrime)[0] = (*isPrime)[1] = false;
49+
for (int i = 2; i * i <= N; ++i)
50+
if ((*isPrime)[i])
51+
for (int j = i * i; j <= N; j += i)
52+
(*isPrime)[j] = false;
53+
54+
return isPrime;
55+
}
56+
57+
//Returns (x ^ n)
58+
int pow(const int &x, int n)
59+
{
60+
if (n == 0)
61+
return 1;
62+
int h = pow(x, n / 2);
63+
return (n & 1) ? h * h * x : h * h;
64+
}
65+
66+
//Returns (x ^ n) % M
67+
int pow(const int &x, int n, const int &M)
68+
{
69+
if (n == 0)
70+
return 1;
71+
int h = pow(x, n / 2) % M;
72+
return (n & 1) ? (h * h * x) % M : (h * h) % M;
73+
}
74+
75+
//Returns all Primes <= N
76+
vector<int> *primesUptoN(const int N)
77+
{
78+
vector<bool> *isPrime = seiveOfEratosthenes(N);
79+
vector<int> *Primes = new vector<int>;
80+
if (2 <= N)
81+
(*Primes).push_back(2);
82+
for (int i = 3; i <= N; i += 2)
83+
if ((*isPrime)[i])
84+
(*Primes).push_back(i);
85+
return Primes;
86+
}
87+
88+
} Math;
89+
//------------------------------------------------------------------------------
90+
void solve()
91+
{
92+
int i = 0;
93+
int in = 0;
94+
do
95+
{
96+
cout << A[i++] << endl;
97+
fflush(stdout);
98+
cin >> in;
99+
} while (in == 0);
100+
}
101+
//------------------------------------------------------------------------------
102+
int32_t main()
103+
{
104+
// FastIO;
105+
for (int i = 1; i <= 1e6; i++)
106+
{
107+
long double sq = sqrt(i);
108+
if (floor(sq) == ceil(sq))
109+
A.push_back(i);
110+
}
111+
w(T)
112+
solve();
113+
114+
return 0;
115+
}
116+
//------------------------------------------------------------------------------

Guess_the_Number.exe

65 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"A. Deadline","group":"Codeforces - Educational Codeforces Round 80 (Rated for Div. 2)","url":"https://codeforces.com/problemset/problem/1288/A","interactive":false,"memoryLimit":256,"timeLimit":2000,"tests":[{"input":"3\n1 1\n4 5\n5 11\n","output":"YES\nYES\nNO\n","id":1616507626779}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"ADeadline"}},"batch":{"id":"7086097f-3b74-4beb-a884-0ff0da89eae2","size":1},"srcPath":"c:\\Users\\Dhruv\\myGithub\\Competitive-Programming\\Practice\\A_Deadline.cpp"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"B. Yet Another Meme Problem","group":"Codeforces - Educational Codeforces Round 80 (Rated for Div. 2)","url":"https://codeforces.com/problemset/problem/1288/B","interactive":false,"memoryLimit":256,"timeLimit":1000,"tests":[{"input":"3\n1 11\n4 2\n191 31415926\n","output":"1\n0\n1337\n","id":1616508670836}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"BYetAnotherMemeProblem"}},"batch":{"id":"cabb044c-aef0-4564-8067-97a8969bb00e","size":1},"srcPath":"c:\\Users\\Dhruv\\myGithub\\Competitive-Programming\\Practice\\B_Yet_Another_Meme_Problem.cpp"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"Chef and Dynamo","group":"CodeChef - Practice(Easy)","url":"https://www.codechef.com/PRACTICE/problems/DYNAMO","interactive":true,"memoryLimit":256,"timeLimit":1000,"tests":[],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"ChefAndDynamo"}},"batch":{"id":"747eaf98-a78b-43be-8290-695a2afc7f81","size":1},"srcPath":"c:\\Users\\Dhruv\\myGithub\\Competitive-Programming\\Practice\\Chef_and_Dynamo.cpp"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"Chefina and Prefix Suffix Sums","group":"CodeChef - Practice(Medium)","url":"https://www.codechef.com/PRACTICE/problems/CHEFPSA","interactive":false,"memoryLimit":256,"timeLimit":1000,"tests":[{"input":"4\n1\n-1 1\n1\n0 0\n2\n4 3 1 4\n3\n5 3 7 10 5 10","output":"0\n1\n2\n4","id":1616483391416},{"id":1616484630252,"input":"1\n3\n-1 -1 -1 0 0 0","output":""}],"testType":"single","input":{"type":"stdin"},"output":{"type":"stdout"},"languages":{"java":{"mainClass":"Main","taskClass":"ChefinaAndPrefixSuffixSums"}},"batch":{"id":"eb2c2d99-cfb4-44ae-a6e4-6f59b4005ff5","size":1},"srcPath":"c:\\Users\\Dhruv\\myGithub\\Competitive-Programming\\Practice\\Chefina_and_Prefix_Suffix_Sums.cpp"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"Local: Nesting Depth","url":"c:\\Users\\Dhruv\\myGithub\\Competitive-Programming\\Practice\\Nesting Depth.cpp","tests":[{"id":1616390037735,"input":"4\n0000\n101\n111000\n1","output":"Case #1: 0000\nCase #2: (1)0(1)\nCase #3: (111)000\nCase #4: (1)"}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"c:\\Users\\Dhruv\\myGithub\\Competitive-Programming\\Practice\\Nesting Depth.cpp","group":"local","local":true}

0 commit comments

Comments
 (0)