Skip to content

Commit 3ad34ed

Browse files
committed
move folders of people who success the challenge to hall of fame foler
1 parent 9e31d65 commit 3ad34ed

File tree

2,006 files changed

+106909
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,006 files changed

+106909
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include<bits/stdc++.h>
2+
#define ioboost ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
3+
4+
using namespace std;
5+
6+
int main() {
7+
ioboost;
8+
9+
int n;
10+
int result[2]={ 0 };
11+
cin>>n;
12+
13+
for(int i=0; i<n; i++) {
14+
int tmp;
15+
cin>>tmp;
16+
result[tmp]+=1;
17+
}
18+
cout<<(result[0]>result[1]?"Junhee is not cute!":"Junhee is cute!")<<"\n";
19+
20+
return 0;
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include<bits/stdc++.h>
2+
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
3+
4+
using namespace std;
5+
6+
int main() {
7+
fastio;
8+
9+
int t, n;
10+
int plus[10]={ 0, 1, 2, 4 };
11+
cin>>t;
12+
13+
for(int i=4; i<11; i++) {
14+
plus[i]=plus[i-1]+plus[i-2]+plus[i-3];
15+
}
16+
17+
for(int i=0; i<t; i++) {
18+
cin>>n;
19+
cout<<plus[n]<<"\n";
20+
}
21+
return 0;
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#include <bits/stdc++.h>
2+
#define ioboost ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
3+
4+
using namespace std;
5+
using ll=long long;
6+
7+
int n;
8+
int dp[1000001]={};
9+
10+
int main() {
11+
ioboost;
12+
13+
cin>>n;
14+
15+
for(int i=1; i<=n; i++) {
16+
dp[i]=i;
17+
}
18+
19+
for(int i=2; i<=n; i++) {
20+
if(i%2==0) {
21+
dp[i]=min(dp[i], dp[i/2]);
22+
}
23+
if(i%3==0) {
24+
dp[i]=min(dp[i], dp[i/3]);
25+
}
26+
dp[i]=min(dp[i], dp[i-1])+1;
27+
}
28+
29+
cout<<dp[n]-1<<"\n";
30+
31+
while(n!=0) {
32+
cout<<n<<" ";
33+
34+
if(dp[n]==dp[n-1]+1) {
35+
n-=1;
36+
} else if(n%2==0&&dp[n]==dp[n/2]+1) {
37+
n/=2;
38+
} else if(n%3==0&&dp[n]==dp[n/3]+1) {
39+
n/=3;
40+
}
41+
}
42+
cout<<"\n";
43+
44+
return 0;
45+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include<bits/stdc++.h>
2+
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
3+
4+
using namespace std;
5+
6+
int main() {
7+
fastio;
8+
9+
int i, n;
10+
int one[1000001]={ 0 };
11+
cin>>n;
12+
13+
for(int i=2; i<=n; i++) {
14+
one[i]=one[i-1]+1;
15+
16+
if(i%2==0) {
17+
one[i]=min(one[i], one[i/2]+1);
18+
}
19+
20+
if(i%3==0) {
21+
one[i]=min(one[i], one[i/3]+1);
22+
}
23+
}
24+
cout<<one[n]<<"\n";
25+
26+
return 0;
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <bits/stdc++.h>
2+
#define ioboost ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL)
3+
4+
using namespace std;
5+
using ll=long long;
6+
7+
ll func(ll x) {
8+
ll a=x, b=1, cnt=0;
9+
10+
while(a) {
11+
cnt+=(x+1)/(b<<1)*b;
12+
13+
if(a&1) cnt+=(x+1)%b;
14+
a>>=1; b<<=1;
15+
}
16+
return cnt;
17+
}
18+
19+
int main() {
20+
ioboost;
21+
22+
ll a, b;
23+
cin>>a>>b;
24+
cout<<func(b)-func(a-1)<<"\n";
25+
26+
return 0;
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include<bits/stdc++.h>
2+
#define ioboost ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
3+
4+
using namespace std;
5+
using ll=long long;
6+
7+
int dp[1001]={ 0, 1, 3 };
8+
9+
int func(int n) {
10+
if(dp[n]) {
11+
return dp[n];
12+
}
13+
return dp[n]=(func(n-1)%10007+2*func(n-2)%10007)%10007;
14+
}
15+
16+
int main() {
17+
ioboost;
18+
19+
int n;
20+
cin>>n;
21+
cout<<func(n)<<"\n";
22+
23+
return 0;
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include <bits/stdc++.h>
2+
#define ioboost ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL)
3+
4+
using namespace std;
5+
6+
typedef long l;
7+
typedef long long ll;
8+
typedef size_t st;
9+
10+
int main() {
11+
ioboost;
12+
13+
l a, b, ans=1;
14+
cin>>a>>b;
15+
16+
while(b>=a) {
17+
if(a==b) {
18+
cout<<ans<<"\n";
19+
20+
return 0;
21+
}
22+
23+
ans++;
24+
25+
if(b%2==0) {
26+
b/=2;
27+
} else if(b%10==1) {
28+
b-=1;
29+
b/=10;
30+
} else {
31+
break;
32+
}
33+
}
34+
cout<<-1<<"\n";
35+
36+
return 0;
37+
}
+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#include <bits/stdc++.h>
2+
#define ioboost ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL)
3+
4+
using namespace std;
5+
6+
typedef long long ll;
7+
typedef size_t st;
8+
typedef vector<int> vi;
9+
typedef pair<int, int> pi;
10+
typedef vector<ll> vll;
11+
typedef pair<ll, ll> pll;
12+
13+
int main() {
14+
ioboost;
15+
16+
int t, n;
17+
cin>>t;
18+
19+
while(t--) {
20+
deque<int> d;
21+
bool err=0, res=0;
22+
string str, order, s="";
23+
cin>>order;
24+
cin>>n;
25+
cin>>str;
26+
27+
for(int i=0; i<str.length(); i++) {
28+
if(isdigit(str[i])) {
29+
s+=str[i];
30+
} else {
31+
if(!s.empty()) {
32+
d.push_back(stoi(s));
33+
s="";
34+
}
35+
}
36+
}
37+
38+
for(auto t: order) {
39+
if(t=='R') {
40+
if(!res) {
41+
res=1;
42+
} else {
43+
res=0;
44+
}
45+
} else {
46+
if(d.empty()) {
47+
cout<<"error"<<"\n";
48+
err=1;
49+
50+
break;
51+
}
52+
53+
if(!res) {
54+
d.pop_front();
55+
} else {
56+
d.pop_back();
57+
}
58+
}
59+
}
60+
61+
if(!err) {
62+
cout<<"[";
63+
}
64+
65+
if(res&&!d.empty()) {
66+
for(auto t=d.rbegin(); t!=d.rend(); t++) {
67+
if(t!=d.rend()-1) {
68+
cout<<*t<<",";
69+
} else {
70+
cout<<*t;
71+
}
72+
}
73+
} else if(!res&&!d.empty()) {
74+
for(auto t=d.begin(); t!=d.end(); t++) {
75+
if(t!=d.end()-1) {
76+
cout<<*t<<",";
77+
} else {
78+
cout<<*t;
79+
}
80+
}
81+
}
82+
83+
if(!err) {
84+
cout<<"]\n";
85+
}
86+
}
87+
return 0;
88+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#include <bits/stdc++.h>
2+
#define ioboost ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL)
3+
4+
using namespace std;
5+
using ll = long long;
6+
7+
int main() {
8+
ioboost;
9+
10+
int t;
11+
cin>>t;
12+
13+
while(t--) {
14+
int n, k;
15+
int time[1002];
16+
cin>>n>>k;
17+
18+
for(int i=1; i<=n; i++) {
19+
cin>>time[i];
20+
}
21+
22+
vector<int> vi[1002];
23+
int res[1002], ind[1002]={};
24+
queue<int> qi;
25+
26+
while(k--) {
27+
int a, b;
28+
cin>>a>>b;
29+
vi[a].push_back(b);
30+
ind[b]++;
31+
}
32+
33+
int w;
34+
cin>>w;
35+
36+
for(int i=1; i<=n; i++) {
37+
if(ind[i]==0) qi.push(i);
38+
res[i]=time[i];
39+
}
40+
41+
while(!qi.empty()) {
42+
int tmp=qi.front();
43+
qi.pop();
44+
45+
for(int i=0; i<vi[tmp].size(); i++) {
46+
int nxt=vi[tmp][i];
47+
ind[nxt]--;
48+
res[nxt]=max(res[nxt], res[tmp]+time[nxt]);
49+
50+
if(ind[nxt]==0) qi.push(nxt);
51+
}
52+
}
53+
cout<<res[w]<<"\n";
54+
}
55+
return 0;
56+
}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <bits/stdc++.h>
2+
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
3+
4+
using namespace std;
5+
6+
int main() {
7+
fastio;
8+
9+
int n, time=0, result=0;
10+
cin>>n;
11+
int line[n];
12+
13+
for(int i=0; i<n; i++) {
14+
cin>>line[i];
15+
}
16+
17+
sort(line, line+n);
18+
19+
for(int i=0; i<n; i++) {
20+
time+=line[i];
21+
result+=time;
22+
}
23+
cout<<result<<"\n";
24+
25+
return 0;
26+
}

0 commit comments

Comments
 (0)