-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40ecda9
commit 0359171
Showing
37 changed files
with
1,159 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#include "bits/stdc++.h" | ||
using namespace std; | ||
|
||
# define s(n) scanf("%d",&n) | ||
# define sc(n) scanf("%c",&n) | ||
# define sl(n) scanf("%lld",&n) | ||
# define sf(n) scanf("%lf",&n) | ||
# define ss(n) scanf("%s",n) | ||
|
||
#define R(i,n) for(int i=0;i<(n);i++) | ||
#define FOR(i,a,b) for(int i=(a);i<=(b);i++) | ||
#define FORD(i,a,b) for(int i=(a);i>=(b);i--) | ||
|
||
# define INF (int)1e9 | ||
# define EPS 1e-9 | ||
# define MOD 1000000007 | ||
|
||
|
||
typedef long long ll; | ||
int minCost(int cost[R][C], int n) | ||
{ | ||
int i, j; | ||
|
||
// Instead of following line, we can use int tc[m+1][n+1] or | ||
// dynamically allocate memoery to save space. The following line is | ||
// used to keep te program simple and make it working on all compilers. | ||
int tc[R][C]; | ||
|
||
tc[0][0] = cost[0][0]; | ||
|
||
/* Initialize first column of total cost(tc) array */ | ||
for (i = 1; i <= n; i++) | ||
tc[i][0] = tc[i-1][0] + cost[i][0]; | ||
|
||
/* Initialize first row of tc array */ | ||
for (j = 1; j <= n; j++) | ||
tc[0][j] = tc[0][j-1] + cost[0][j]; | ||
|
||
/* Construct rest of the tc array */ | ||
for (i = 1; i <= n; i++) | ||
for (j = 1; j <= n; j++) | ||
tc[i][j] = min(tc[i-1][j-1], | ||
tc[i-1][j], | ||
tc[i][j-1]) + cost[i][j]; | ||
|
||
return tc[m][n]; | ||
} | ||
|
||
int main() | ||
{ | ||
int t; | ||
cin >> t; | ||
while(t--){ | ||
int n; | ||
s(n); | ||
int a[n][n]; | ||
R(i,n){ | ||
R(j,5){ | ||
s(a[i[j]]); | ||
} | ||
} | ||
int c,r,d; | ||
s(c);s(r);s(d); | ||
} | ||
|
||
return 0; | ||
} |
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include "bits/stdc++.h" | ||
using namespace std; | ||
|
||
# define s(n) scanf("%d",&n) | ||
# define sc(n) scanf("%c",&n) | ||
# define sl(n) scanf("%lld",&n) | ||
# define sf(n) scanf("%lf",&n) | ||
# define ss(n) scanf("%s",n) | ||
|
||
#define R(i,n) for(int i=0;i<(n);i++) | ||
#define FOR(i,a,b) for(int i=(a);i<=(b);i++) | ||
#define FORD(i,a,b) for(int i=(a);i>=(b);i--) | ||
|
||
# define INF (int)1e9 | ||
# define EPS 1e-9 | ||
# define MOD 1000000007 | ||
|
||
|
||
typedef long long ll; | ||
|
||
int main() | ||
{ | ||
int t; | ||
cin >> t; | ||
while(t--){ | ||
int n,k; | ||
s(n);s(k); | ||
int a[n]; | ||
R(i,n){ | ||
s(a[i]); | ||
} | ||
sort(a,a+n); | ||
if(k>n){ | ||
printf("1000\n"); | ||
}else { | ||
printf("%d\n",a[(n+k)/2]); | ||
} | ||
} | ||
|
||
return 0; | ||
} |
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include "bits/stdc++.h" | ||
using namespace std; | ||
|
||
# define s(n) scanf("%d",&n) | ||
# define sc(n) scanf("%c",&n) | ||
# define sl(n) scanf("%lld",&n) | ||
# define sf(n) scanf("%lf",&n) | ||
# define ss(n) scanf("%s",n) | ||
|
||
#define R(i,n) for(int i=0;i<(n);i++) | ||
#define FOR(i,a,b) for(int i=(a);i<=(b);i++) | ||
#define FORD(i,a,b) for(int i=(a);i>=(b);i--) | ||
|
||
# define INF (int)1e9 | ||
# define EPS 1e-9 | ||
# define MOD 1000000007 | ||
|
||
|
||
typedef long long ll; | ||
|
||
int main() | ||
{ | ||
int t; | ||
cin >> t; | ||
while(t--){ | ||
string s; | ||
cin >> s; | ||
ll ans=0; | ||
vector<char> v; | ||
bool flag=false; | ||
v.push_back(s[0]); | ||
if(s.length()==1){ | ||
printf("0\n"); | ||
continue; | ||
} | ||
R(i,s.length()-1){ | ||
if(s[i]==s[i+1]){ | ||
ans++; | ||
} else { | ||
v.push_back(s[i+1]); | ||
} | ||
} | ||
// R(i,v.size()){ | ||
// printf("%c",v[i]); | ||
// } | ||
// printf("\n"); | ||
|
||
R(i,(int)v.size()-2){ | ||
if(v[i]==v[i+2] && v[i]!=v[i+1]){ | ||
ans++; | ||
} | ||
} | ||
|
||
printf("%lld\n", ans ); | ||
} | ||
|
||
return 0; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "bits/stdc++.h" | ||
using namespace std; | ||
|
||
# define s(n) scanf("%d",&n) | ||
# define sc(n) scanf("%c",&n) | ||
# define sl(n) scanf("%lld",&n) | ||
# define sf(n) scanf("%lf",&n) | ||
# define ss(n) scanf("%s",n) | ||
|
||
#define R(i,n) for(int i=0;i<(n);i++) | ||
#define FOR(i,a,b) for(int i=(a);i<=(b);i++) | ||
#define FORD(i,a,b) for(int i=(a);i>=(b);i--) | ||
|
||
# define INF (int)1e9 | ||
# define EPS 1e-9 | ||
# define MOD 1000000007 | ||
|
||
|
||
typedef long long ll; | ||
|
||
int main() | ||
{ | ||
int t; | ||
cin >> t; | ||
while(t--){ | ||
|
||
} | ||
|
||
return 0; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include "bits/stdc++.h" | ||
using namespace std; | ||
|
||
# define s(n) scanf("%d",&n) | ||
# define sc(n) scanf("%c",&n) | ||
# define sl(n) scanf("%lld",&n) | ||
# define sf(n) scanf("%lf",&n) | ||
# define ss(n) scanf("%s",n) | ||
|
||
#define R(i,n) for(int i=0;i<(n);i++) | ||
#define FOR(i,a,b) for(int i=(a);i<=(b);i++) | ||
#define FORD(i,a,b) for(int i=(a);i>=(b);i--) | ||
|
||
# define INF (int)1e9 | ||
# define EPS 1e-9 | ||
# define MOD 1000000007 | ||
|
||
|
||
typedef long long ll; | ||
|
||
int main() | ||
{ | ||
int t; | ||
cin >> t; | ||
while(t--){ | ||
ll n; | ||
sl(n); | ||
|
||
int i=0; | ||
R(i,99980){ | ||
printf("42958 "); | ||
} | ||
R(i,10){ | ||
printf("2643 "); | ||
} | ||
int f=n-99990; | ||
R(i,f-1){ | ||
printf("1 "); | ||
} | ||
printf("1\n"); | ||
|
||
} | ||
|
||
return 0; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "bits/stdc++.h" | ||
using namespace std; | ||
|
||
# define s(n) scanf("%d",&n) | ||
# define sc(n) scanf("%c",&n) | ||
# define sl(n) scanf("%lld",&n) | ||
# define sf(n) scanf("%lf",&n) | ||
# define ss(n) scanf("%s",n) | ||
|
||
#define R(i,n) for(int i=0;i<(n);i++) | ||
#define FOR(i,a,b) for(int i=(a);i<=(b);i++) | ||
#define FORD(i,a,b) for(int i=(a);i>=(b);i--) | ||
|
||
# define INF (int)1e9 | ||
# define EPS 1e-9 | ||
# define MOD 1000000007 | ||
|
||
|
||
typedef long long ll; | ||
|
||
int main() | ||
{ | ||
int t; | ||
cin >> t; | ||
while(t--){ | ||
|
||
} | ||
|
||
return 0; | ||
} |
Binary file not shown.
Oops, something went wrong.