-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
70 changed files
with
1,077 additions
and
186,724 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Binary file not shown.
Empty file.
Binary file not shown.
Empty file.
Binary file not shown.
Empty file.
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,65 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <sstream> | ||
#include <vector> | ||
#include <set> | ||
#include <map> | ||
#include <list> | ||
#include <queue> | ||
#include <stack> | ||
#include <memory> | ||
#include <iomanip> | ||
#include <numeric> | ||
#include <functional> | ||
#include <new> | ||
#include <algorithm> | ||
#include <cmath> | ||
#include <cstring> | ||
#include <cstdlib> | ||
#include <cstdio> | ||
#include <climits> | ||
#include <cctype> | ||
#include <ctime> | ||
|
||
#define REP(i, n) for(int (i) = 0; i < n; i++) | ||
#define FOR(i, a, n) for(int (i) = a; i < n; i++) | ||
#define FORR(i, a, n) for(int (i) = a; i <= n; i++) | ||
#define for_each(q, s) for(typeof(s.begin()) q=s.begin(); q!=s.end(); q++) | ||
#define sz(n) n.size() | ||
#define pb(n) push_back(n) | ||
#define all(n) n.begin(), n.end() | ||
|
||
template<typename T> T gcd(T a, T b) { | ||
if(!b) return a; | ||
return gcd(b, a % b); | ||
} | ||
template<typename T> T lcm(T a, T b) { | ||
return a * b / gcd(a, b); | ||
} | ||
|
||
template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; } | ||
template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; } | ||
int in() { int x; scanf("%d", &x); return x; } | ||
|
||
using namespace std; | ||
|
||
typedef long long Int; | ||
typedef unsigned uint; | ||
|
||
const int MAXN = 101010; | ||
|
||
int N; | ||
|
||
char str[110][110]; | ||
|
||
vector<int> graph[MAXN]; | ||
|
||
int main(void) { | ||
for ( ; scanf("%d", &N) == 1; ) { | ||
for (i = 0; i < N; i++) { | ||
scanf("%s", str[i]); | ||
} | ||
} | ||
|
||
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,59 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <sstream> | ||
#include <vector> | ||
#include <set> | ||
#include <map> | ||
#include <list> | ||
#include <queue> | ||
#include <stack> | ||
#include <memory> | ||
#include <iomanip> | ||
#include <numeric> | ||
#include <functional> | ||
#include <new> | ||
#include <algorithm> | ||
#include <cmath> | ||
#include <cstring> | ||
#include <cstdlib> | ||
#include <cstdio> | ||
#include <climits> | ||
#include <cctype> | ||
#include <ctime> | ||
|
||
#define REP(i, n) for(int (i) = 0; i < n; i++) | ||
#define FOR(i, a, n) for(int (i) = a; i < n; i++) | ||
#define FORR(i, a, n) for(int (i) = a; i <= n; i++) | ||
#define for_each(q, s) for(typeof(s.begin()) q=s.begin(); q!=s.end(); q++) | ||
#define sz(n) n.size() | ||
#define pb(n) push_back(n) | ||
#define all(n) n.begin(), n.end() | ||
|
||
template<typename T> T gcd(T a, T b) { | ||
if(!b) return a; | ||
return gcd(b, a % b); | ||
} | ||
template<typename T> T lcm(T a, T b) { | ||
return a * b / gcd(a, b); | ||
} | ||
|
||
template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; } | ||
template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; } | ||
int in() { int x; scanf("%d", &x); return x; } | ||
|
||
using namespace std; | ||
|
||
typedef long long Int; | ||
typedef unsigned uint; | ||
|
||
Int L, P, V; | ||
|
||
int main(void) { | ||
int T = 1; | ||
|
||
for ( ; scanf("%lld%lld%lld", &L, &P, &V) == 3 && L + P + V != 0LL; ) { | ||
printf("Case %d: %lld\n", T++, V / P * L + min(L, V % P)); | ||
} | ||
|
||
return 0; | ||
} |
Empty file.
Binary file not shown.
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,68 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <sstream> | ||
#include <vector> | ||
#include <set> | ||
#include <map> | ||
#include <list> | ||
#include <queue> | ||
#include <stack> | ||
#include <memory> | ||
#include <iomanip> | ||
#include <numeric> | ||
#include <functional> | ||
#include <new> | ||
#include <algorithm> | ||
#include <cmath> | ||
#include <cstring> | ||
#include <cstdlib> | ||
#include <cstdio> | ||
#include <climits> | ||
#include <cctype> | ||
#include <ctime> | ||
|
||
#define REP(i, n) for(int (i) = 0; i < n; i++) | ||
#define FOR(i, a, n) for(int (i) = a; i < n; i++) | ||
#define FORR(i, a, n) for(int (i) = a; i <= n; i++) | ||
#define for_each(q, s) for(typeof(s.begin()) q=s.begin(); q!=s.end(); q++) | ||
#define sz(n) n.size() | ||
#define pb(n) push_back(n) | ||
#define all(n) n.begin(), n.end() | ||
|
||
template<typename T> T gcd(T a, T b) { | ||
if(!b) return a; | ||
return gcd(b, a % b); | ||
} | ||
template<typename T> T lcm(T a, T b) { | ||
return a * b / gcd(a, b); | ||
} | ||
|
||
template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; } | ||
template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; } | ||
int in() { int x; scanf("%d", &x); return x; } | ||
|
||
using namespace std; | ||
|
||
typedef long long Int; | ||
typedef unsigned uint; | ||
|
||
int P, T; | ||
int V[15]; | ||
|
||
int main(void) { | ||
P = in(); | ||
|
||
int i; | ||
int x; | ||
|
||
for (x = 1; x <= P; x++) { | ||
T = in(); | ||
for (i = 0; i < 10; i++) V[i] = in(); | ||
|
||
sort(V, V + 10); | ||
|
||
printf("%d %d\n", T, V[7]); | ||
} | ||
|
||
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,68 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <sstream> | ||
#include <vector> | ||
#include <set> | ||
#include <map> | ||
#include <list> | ||
#include <queue> | ||
#include <stack> | ||
#include <memory> | ||
#include <iomanip> | ||
#include <numeric> | ||
#include <functional> | ||
#include <new> | ||
#include <algorithm> | ||
#include <cmath> | ||
#include <cstring> | ||
#include <cstdlib> | ||
#include <cstdio> | ||
#include <climits> | ||
#include <cctype> | ||
#include <ctime> | ||
|
||
#define REP(i, n) for(int (i) = 0; i < n; i++) | ||
#define FOR(i, a, n) for(int (i) = a; i < n; i++) | ||
#define FORR(i, a, n) for(int (i) = a; i <= n; i++) | ||
#define for_each(q, s) for(typeof(s.begin()) q=s.begin(); q!=s.end(); q++) | ||
#define sz(n) n.size() | ||
#define pb(n) push_back(n) | ||
#define all(n) n.begin(), n.end() | ||
|
||
template<typename T> T gcd(T a, T b) { | ||
if(!b) return a; | ||
return gcd(b, a % b); | ||
} | ||
template<typename T> T lcm(T a, T b) { | ||
return a * b / gcd(a, b); | ||
} | ||
|
||
template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; } | ||
template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; } | ||
int in() { int x; scanf("%d", &x); return x; } | ||
|
||
using namespace std; | ||
|
||
typedef long long Int; | ||
typedef unsigned uint; | ||
|
||
int P, T; | ||
char str[111010]; | ||
|
||
int main(void) { | ||
P = in(); | ||
|
||
for ( ; P--; ) { | ||
T = in(); | ||
printf("%d ", T); | ||
scanf("%s", str); | ||
|
||
if (next_permutation(str, str + strlen(str))) { | ||
puts(str); | ||
} else { | ||
puts("BIGGEST"); | ||
} | ||
} | ||
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,130 @@ | ||
#include <iostream> | ||
#include <string> | ||
#include <sstream> | ||
#include <vector> | ||
#include <set> | ||
#include <map> | ||
#include <list> | ||
#include <queue> | ||
#include <stack> | ||
#include <memory> | ||
#include <iomanip> | ||
#include <numeric> | ||
#include <functional> | ||
#include <new> | ||
#include <algorithm> | ||
#include <cmath> | ||
#include <cstring> | ||
#include <cstdlib> | ||
#include <cstdio> | ||
#include <climits> | ||
#include <cctype> | ||
#include <ctime> | ||
|
||
#define REP(i, n) for(int (i) = 0; i < n; i++) | ||
#define FOR(i, a, n) for(int (i) = a; i < n; i++) | ||
#define FORR(i, a, n) for(int (i) = a; i <= n; i++) | ||
#define for_each(q, s) for(typeof(s.begin()) q=s.begin(); q!=s.end(); q++) | ||
#define sz(n) n.size() | ||
#define pb(n) push_back(n) | ||
#define all(n) n.begin(), n.end() | ||
|
||
template<typename T> T gcd(T a, T b) { | ||
if(!b) return a; | ||
return gcd(b, a % b); | ||
} | ||
template<typename T> T lcm(T a, T b) { | ||
return a * b / gcd(a, b); | ||
} | ||
|
||
template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; } | ||
template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; } | ||
int in() { int x; scanf("%d", &x); return x; } | ||
|
||
using namespace std; | ||
|
||
typedef long long Int; | ||
typedef unsigned uint; | ||
|
||
const int MAXN = 550; | ||
const int INF = INT_MAX / 3; | ||
|
||
int N, M; | ||
|
||
int vis[MAXN]; | ||
int mrk[MAXN]; | ||
int deg[MAXN]; | ||
|
||
vector<int> graph[MAXN]; | ||
|
||
bool good; | ||
|
||
int dfs(int x, int p) { | ||
mrk[x] = 1; | ||
|
||
if (vis[x]) { | ||
good = false; | ||
return -INF; | ||
} | ||
|
||
vis[x] = 1; | ||
|
||
int i, ans = 0; | ||
|
||
for (i = 0; i < (int) graph[x].size(); i++) { | ||
int u = graph[x][i]; | ||
|
||
if (u != p) ans += dfs(u, x); | ||
} | ||
|
||
return 1 + ans; | ||
} | ||
|
||
|
||
int main(void) { | ||
int i; | ||
int A, B; | ||
int T = 1; | ||
|
||
for ( ; scanf("%d%d", &N, &M) == 2 && N + M != 0; ) { | ||
for (i = 0; i < MAXN; i++) { | ||
vis[i] = mrk[i] = deg[i] = 0; | ||
graph[i].clear(); | ||
} | ||
|
||
for (i = 0; i < M; i++) { | ||
A = in(); | ||
B = in(); | ||
|
||
graph[A].push_back(B); | ||
graph[B].push_back(A); | ||
|
||
deg[A] += 1; | ||
deg[B] += 1; | ||
} | ||
|
||
int tree = 0; | ||
|
||
for (i = 1; i <= N; i++) if (!mrk[i]) { | ||
good = true; | ||
int curr = dfs(i, -1); | ||
|
||
if (good) { | ||
tree += 1; | ||
} | ||
memset(vis, 0, sizeof(vis)); | ||
} | ||
|
||
printf("Case %d: ", T++); | ||
|
||
if (tree > 1) { | ||
printf("A forest of %d trees.\n", tree); | ||
} else if (tree == 1) { | ||
puts("There is one tree."); | ||
} else { | ||
puts("No trees."); | ||
} | ||
} | ||
return 0; | ||
} | ||
|
Empty file.
Binary file not shown.
Oops, something went wrong.