delete include
This commit is contained in:
parent
5d7fc40565
commit
b4a3cb98a8
|
@ -1,23 +1,23 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
// ??? // ????
|
// ??? // ????
|
||||||
// ?????
|
// ?????
|
||||||
/*
|
/*
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int arr[100], i = 0, sum = 0;
|
int arr[100], i = 0, sum = 0;
|
||||||
while (getint()) {
|
while (getint()) {
|
||||||
arr[i] = getint();
|
arr[i] = getint();
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}*/
|
}*/
|
||||||
int main() {
|
int main() {
|
||||||
int arr[100], i = 0, sum = 0;
|
int arr[100], i = 0, sum = 0;
|
||||||
while (getint()) {
|
while (getint()) {
|
||||||
arr[i] = getint();
|
arr[i] = getint();
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
|
||||||
while (i) {
|
|
||||||
i = i - 1;
|
|
||||||
sum = sum + arr[i];
|
|
||||||
}
|
}
|
||||||
return sum % 79;
|
while (i) {
|
||||||
|
i = i - 1;
|
||||||
|
sum = sum + arr[i];
|
||||||
|
}
|
||||||
|
return sum % 79;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int main() {
|
int main() {
|
||||||
int a, b = 8, c = 12;
|
int a, b = 8, c = 12;
|
||||||
a = b + c;
|
a = b + c;
|
||||||
return a;
|
return a;
|
||||||
int d = 9;
|
int d = 9;
|
||||||
a = a * d;
|
a = a * d;
|
||||||
return a;
|
return a;
|
||||||
#define A 4
|
#define A 4
|
||||||
a = (A - b) * c;
|
a = (A - b) * c;
|
||||||
return a;
|
return a;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +1,54 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int main(){
|
int main(){
|
||||||
int a = 893;
|
int a = 893;
|
||||||
int b = 716;
|
int b = 716;
|
||||||
{
|
{
|
||||||
int a = 837;
|
int a = 837;
|
||||||
a = a + 128;
|
a = a + 128;
|
||||||
b = b + a;
|
b = b + a;
|
||||||
{
|
{
|
||||||
int b = 241;
|
int b = 241;
|
||||||
a = a + b - 412;
|
a = a + b - 412;
|
||||||
{
|
{
|
||||||
int a = 771;
|
int a = 771;
|
||||||
b = b + a -18;
|
b = b + a -18;
|
||||||
a = b + 66;
|
a = b + 66;
|
||||||
}
|
}
|
||||||
b = b + a - 33;
|
b = b + a - 33;
|
||||||
a = b - 55;
|
a = b - 55;
|
||||||
{
|
{
|
||||||
return (a + b) % 21;
|
return (a + b) % 21;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
a = b + a - 97;
|
a = b + a - 97;
|
||||||
b = (b - a) % 62;
|
b = (b - a) % 62;
|
||||||
{
|
{
|
||||||
return (a + b) % 17;
|
return (a + b) % 17;
|
||||||
}
|
}
|
||||||
return (a + b) % 13;
|
return (a + b) % 13;
|
||||||
}
|
}
|
||||||
a = (b * a) % 83;
|
a = (b * a) % 83;
|
||||||
b = a + b - 771;
|
b = a + b - 771;
|
||||||
return (a + b) % 11;
|
return (a + b) % 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int main() {
|
int main() {
|
||||||
#define a 1
|
#define a 1
|
||||||
#define b 2
|
#define b 2
|
||||||
#define c 3
|
#define c 3
|
||||||
#define d 4
|
#define d 4
|
||||||
#define e 5
|
#define e 5
|
||||||
#define f 6
|
#define f 6
|
||||||
if (a * b + c < 6 && d != 0) {
|
if (a * b + c < 6 && d != 0) {
|
||||||
if (e || !a + 0) {
|
if (e || !a + 0) {
|
||||||
if (c == 2 && d + e > 2) return 3;
|
if (c == 2 && d + e > 2) return 3;
|
||||||
else {
|
else {
|
||||||
if (f % c && e) return 4;
|
if (f % c && e) return 4;
|
||||||
else {
|
else {
|
||||||
if (d / b + a >= 2) {
|
if (d / b + a >= 2) {
|
||||||
if (e - f >= 0 || d > 4) return 6;
|
if (e - f >= 0 || d > 4) return 6;
|
||||||
else {
|
else {
|
||||||
if (c != f) {
|
if (c != f) {
|
||||||
if (b + e * d > 10) {
|
if (b + e * d > 10) {
|
||||||
if (!f) return 9;
|
if (!f) return 9;
|
||||||
else return 10;
|
else return 10;
|
||||||
}
|
}
|
||||||
else return 8;
|
else return 8;
|
||||||
}
|
}
|
||||||
else return 7;
|
else return 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else return 5;
|
else return 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else return 2;
|
else return 2;
|
||||||
}
|
}
|
||||||
else return 1;
|
else return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +1,40 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int main() {
|
int main() {
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(i < 20) {
|
while(i < 20) {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
while (j < 10) {
|
while (j < 10) {
|
||||||
int k = 0;
|
int k = 0;
|
||||||
while (k < 5) {
|
while (k < 5) {
|
||||||
int m = 0;
|
int m = 0;
|
||||||
while (m < 3) {
|
while (m < 3) {
|
||||||
if (m + 1 >= 3)
|
if (m + 1 >= 3)
|
||||||
if (m)
|
if (m)
|
||||||
if (m || !m)
|
if (m || !m)
|
||||||
if (m - -1 >= 3)
|
if (m - -1 >= 3)
|
||||||
{{{{;;break;continue;}}}}
|
{{{{;;break;continue;}}}}
|
||||||
int n = 0;
|
int n = 0;
|
||||||
while (n < 2) {
|
while (n < 2) {
|
||||||
n = n + 1;
|
n = n + 1;
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
sum = sum + 1;
|
sum = sum + 1;
|
||||||
}
|
}
|
||||||
m = m + 1;
|
m = m + 1;
|
||||||
sum = sum + 1;
|
sum = sum + 1;
|
||||||
}
|
}
|
||||||
while(1) {
|
while(1) {
|
||||||
while(1) break;
|
while(1) break;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
k = k + 1;
|
k = k + 1;
|
||||||
}
|
}
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
continue;
|
continue;
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,87 +1,87 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int quick_read(){
|
int quick_read(){
|
||||||
int ch = getch(); int x = 0, f = 0;
|
int ch = getch(); int x = 0, f = 0;
|
||||||
while (ch < 48 || ch > 57){
|
while (ch < 48 || ch > 57){
|
||||||
if (ch == 45) f = 1;
|
if (ch == 45) f = 1;
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
while (ch >= 48 && ch <=57){
|
while (ch >= 48 && ch <=57){
|
||||||
x = x * 10 + ch - 48;
|
x = x * 10 + ch - 48;
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
if (f) return -x;
|
if (f) return -x;
|
||||||
else return x;
|
else return x;
|
||||||
}
|
}
|
||||||
int n, m;
|
int n, m;
|
||||||
#define maxn 1005
|
#define maxn 1005
|
||||||
#define maxm 5005
|
#define maxm 5005
|
||||||
int to[maxm], next[maxm], head[maxn], cnt = 0;
|
int to[maxm], next[maxm], head[maxn], cnt = 0;
|
||||||
int que[maxn], h, tail, inq[maxn];
|
int que[maxn], h, tail, inq[maxn];
|
||||||
void add_edge(int from, int To){
|
void add_edge(int from, int To){
|
||||||
to[cnt] = To;
|
to[cnt] = To;
|
||||||
next[cnt] = head[from];
|
next[cnt] = head[from];
|
||||||
head[from] = cnt;
|
head[from] = cnt;
|
||||||
cnt = cnt + 1;
|
cnt = cnt + 1;
|
||||||
to[cnt] = from;
|
to[cnt] = from;
|
||||||
next[cnt] = head[To];
|
next[cnt] = head[To];
|
||||||
head[To] = cnt;
|
head[To] = cnt;
|
||||||
cnt = cnt + 1;
|
cnt = cnt + 1;
|
||||||
}
|
}
|
||||||
void init(){
|
void init(){
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < maxn){
|
while (i < maxn){
|
||||||
head[i] = -1;
|
head[i] = -1;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void inqueue(int x){
|
void inqueue(int x){
|
||||||
inq[x] = 1;
|
inq[x] = 1;
|
||||||
tail = tail + 1;
|
tail = tail + 1;
|
||||||
que[tail] = x;
|
que[tail] = x;
|
||||||
}
|
}
|
||||||
int pop_queue(){
|
int pop_queue(){
|
||||||
h = h + 1;
|
h = h + 1;
|
||||||
int res = que[h];
|
int res = que[h];
|
||||||
return que[h];
|
return que[h];
|
||||||
}
|
}
|
||||||
int same(int s, int t){
|
int same(int s, int t){
|
||||||
h = 0;
|
h = 0;
|
||||||
tail = 0;
|
tail = 0;
|
||||||
inqueue(s);
|
inqueue(s);
|
||||||
int res = 0;
|
int res = 0;
|
||||||
while (h < tail){
|
while (h < tail){
|
||||||
int x = pop_queue();
|
int x = pop_queue();
|
||||||
if (x == t) res = 1;
|
if (x == t) res = 1;
|
||||||
int i = head[x];
|
int i = head[x];
|
||||||
while (i != -1){
|
while (i != -1){
|
||||||
if (!inq[to[i]]) inqueue(to[i]);
|
if (!inq[to[i]]) inqueue(to[i]);
|
||||||
i = next[i];
|
i = next[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i <= tail){
|
while (i <= tail){
|
||||||
inq[que[i]] = 0;
|
inq[que[i]] = 0;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
int main(){
|
int main(){
|
||||||
n = quick_read(); m = quick_read();
|
n = quick_read(); m = quick_read();
|
||||||
init();
|
init();
|
||||||
while (m){
|
while (m){
|
||||||
int ch = getch();
|
int ch = getch();
|
||||||
while (ch != 81 && ch != 85){
|
while (ch != 81 && ch != 85){
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
if (ch == 81){ // query
|
if (ch == 81){ // query
|
||||||
int x = quick_read(), y = quick_read();
|
int x = quick_read(), y = quick_read();
|
||||||
putint(same(x, y));
|
putint(same(x, y));
|
||||||
putch(10);
|
putch(10);
|
||||||
}else{ // union
|
}else{ // union
|
||||||
int x = quick_read(), y = quick_read();
|
int x = quick_read(), y = quick_read();
|
||||||
add_edge(x, y);
|
add_edge(x, y);
|
||||||
}
|
}
|
||||||
m = m - 1;
|
m = m - 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,76 +1,76 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int quick_read(){
|
int quick_read(){
|
||||||
int ch = getch(); int x = 0, f = 0;
|
int ch = getch(); int x = 0, f = 0;
|
||||||
while (ch < 48 || ch > 57){
|
while (ch < 48 || ch > 57){
|
||||||
if (ch == 45) f = 1;
|
if (ch == 45) f = 1;
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
while (ch >= 48 && ch <=57){
|
while (ch >= 48 && ch <=57){
|
||||||
x = x * 10 + ch - 48;
|
x = x * 10 + ch - 48;
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
if (f) return -x;
|
if (f) return -x;
|
||||||
else return x;
|
else return x;
|
||||||
}
|
}
|
||||||
int n, m;
|
int n, m;
|
||||||
#define maxn 1005
|
#define maxn 1005
|
||||||
#define maxm 5005
|
#define maxm 5005
|
||||||
int to[maxm], next[maxm], head[maxn], cnt = 0;
|
int to[maxm], next[maxm], head[maxn], cnt = 0;
|
||||||
void add_edge(int from, int To){
|
void add_edge(int from, int To){
|
||||||
to[cnt] = To;
|
to[cnt] = To;
|
||||||
next[cnt] = head[from];
|
next[cnt] = head[from];
|
||||||
head[from] = cnt;
|
head[from] = cnt;
|
||||||
cnt = cnt + 1;
|
cnt = cnt + 1;
|
||||||
to[cnt] = from;
|
to[cnt] = from;
|
||||||
next[cnt] = head[To];
|
next[cnt] = head[To];
|
||||||
head[To] = cnt;
|
head[To] = cnt;
|
||||||
cnt = cnt + 1;
|
cnt = cnt + 1;
|
||||||
}
|
}
|
||||||
void init(){
|
void init(){
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < maxn){
|
while (i < maxn){
|
||||||
head[i] = -1;
|
head[i] = -1;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int vis[maxn];
|
int vis[maxn];
|
||||||
void clear(){
|
void clear(){
|
||||||
int i = 1;
|
int i = 1;
|
||||||
while (i <= n){
|
while (i <= n){
|
||||||
vis[i] = 0;
|
vis[i] = 0;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int same(int x, int tar){
|
int same(int x, int tar){
|
||||||
vis[x] = 1;
|
vis[x] = 1;
|
||||||
if (x == tar) return 1;
|
if (x == tar) return 1;
|
||||||
int i = head[x];
|
int i = head[x];
|
||||||
while (i != -1){
|
while (i != -1){
|
||||||
int y = to[i];
|
int y = to[i];
|
||||||
if (!vis[y] && same(y,tar))
|
if (!vis[y] && same(y,tar))
|
||||||
return 1;
|
return 1;
|
||||||
i = next[i];
|
i = next[i];
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int main(){
|
int main(){
|
||||||
n = quick_read(); m = quick_read();
|
n = quick_read(); m = quick_read();
|
||||||
init();
|
init();
|
||||||
while (m){
|
while (m){
|
||||||
int ch = getch();
|
int ch = getch();
|
||||||
while (ch != 81 && ch != 85){
|
while (ch != 81 && ch != 85){
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
if (ch == 81){ // query
|
if (ch == 81){ // query
|
||||||
int x = quick_read(), y = quick_read();
|
int x = quick_read(), y = quick_read();
|
||||||
clear();
|
clear();
|
||||||
putint(same(x, y));
|
putint(same(x, y));
|
||||||
putch(10);
|
putch(10);
|
||||||
}else{ // union
|
}else{ // union
|
||||||
int x = quick_read(), y = quick_read();
|
int x = quick_read(), y = quick_read();
|
||||||
add_edge(x, y);
|
add_edge(x, y);
|
||||||
}
|
}
|
||||||
m = m - 1;
|
m = m - 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,96 +1,96 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#define space 32
|
#define space 32
|
||||||
#define LF 10
|
#define LF 10
|
||||||
#define maxNode 10000
|
#define maxNode 10000
|
||||||
int value[maxNode];
|
int value[maxNode];
|
||||||
int left_child[maxNode];
|
int left_child[maxNode];
|
||||||
int right_child[maxNode];
|
int right_child[maxNode];
|
||||||
int now;
|
int now;
|
||||||
|
|
||||||
int search(int root, int x) {
|
int search(int root, int x) {
|
||||||
if (root == -1 || value[root] == x)
|
if (root == -1 || value[root] == x)
|
||||||
return root;
|
return root;
|
||||||
else if (x > value[root])
|
else if (x > value[root])
|
||||||
return search(right_child[root], x);
|
return search(right_child[root], x);
|
||||||
else
|
else
|
||||||
return search(left_child[root], x);
|
return search(left_child[root], x);
|
||||||
}
|
}
|
||||||
|
|
||||||
int find_minimum(int root) {
|
int find_minimum(int root) {
|
||||||
if (root == -1) {
|
if (root == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (left_child[root] != -1) {
|
else if (left_child[root] != -1) {
|
||||||
return find_minimum(left_child[root]);
|
return find_minimum(left_child[root]);
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
int new_node(int x) {
|
int new_node(int x) {
|
||||||
value[now] = x;
|
value[now] = x;
|
||||||
left_child[now] = -1;
|
left_child[now] = -1;
|
||||||
right_child[now] = -1;
|
right_child[now] = -1;
|
||||||
now = now + 1;
|
now = now + 1;
|
||||||
return now - 1;
|
return now - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int insert(int root, int x) {
|
int insert(int root, int x) {
|
||||||
if (root == -1) {
|
if (root == -1) {
|
||||||
return new_node(x);
|
return new_node(x);
|
||||||
}
|
}
|
||||||
else if (x > value[root])
|
else if (x > value[root])
|
||||||
right_child[root] = insert(right_child[root], x);
|
right_child[root] = insert(right_child[root], x);
|
||||||
else {
|
else {
|
||||||
left_child[root] = insert(left_child[root], x);
|
left_child[root] = insert(left_child[root], x);
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
int delete(int root, int x) {
|
int delete(int root, int x) {
|
||||||
if (root == -1) return -1;
|
if (root == -1) return -1;
|
||||||
if (x > value[root]) right_child[root] = delete(right_child[root], x);
|
if (x > value[root]) right_child[root] = delete(right_child[root], x);
|
||||||
else if (x < value[root]) left_child[root] = delete(left_child[root], x);
|
else if (x < value[root]) left_child[root] = delete(left_child[root], x);
|
||||||
else
|
else
|
||||||
if (left_child[root] == -1 && right_child[root] == -1) return -1;
|
if (left_child[root] == -1 && right_child[root] == -1) return -1;
|
||||||
else if (left_child[root] == -1 || right_child[root] == -1)
|
else if (left_child[root] == -1 || right_child[root] == -1)
|
||||||
if(left_child[root] == -1)
|
if(left_child[root] == -1)
|
||||||
return right_child[root];
|
return right_child[root];
|
||||||
else
|
else
|
||||||
return left_child[root];
|
return left_child[root];
|
||||||
else {
|
else {
|
||||||
int tmp = find_minimum(right_child[root]);
|
int tmp = find_minimum(right_child[root]);
|
||||||
value[root] = value[tmp];
|
value[root] = value[tmp];
|
||||||
right_child[root] = delete(right_child[root], value[tmp]);
|
right_child[root] = delete(right_child[root], value[tmp]);
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
void inorder(int root) {
|
void inorder(int root) {
|
||||||
if (root != -1) {
|
if (root != -1) {
|
||||||
inorder(left_child[root]);
|
inorder(left_child[root]);
|
||||||
putint(value[root]);
|
putint(value[root]);
|
||||||
putch(space);
|
putch(space);
|
||||||
inorder(right_child[root]);
|
inorder(right_child[root]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
now = 0;
|
now = 0;
|
||||||
int n = getint();
|
int n = getint();
|
||||||
if (!n) return 0;
|
if (!n) return 0;
|
||||||
int root = new_node(getint()), i = 1;
|
int root = new_node(getint()), i = 1;
|
||||||
while (i < n) {
|
while (i < n) {
|
||||||
insert(root, getint());
|
insert(root, getint());
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
inorder(root);
|
inorder(root);
|
||||||
putch(LF);
|
putch(LF);
|
||||||
n = getint(); i = 0;
|
n = getint(); i = 0;
|
||||||
while (i < n) {
|
while (i < n) {
|
||||||
root = delete(root, getint());
|
root = delete(root, getint());
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
inorder(root);
|
inorder(root);
|
||||||
putch(LF);
|
putch(LF);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +1,54 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int quick_read(){
|
int quick_read(){
|
||||||
int ch = getch(); int x = 0, f = 0;
|
int ch = getch(); int x = 0, f = 0;
|
||||||
while (ch < 48 || ch > 57){
|
while (ch < 48 || ch > 57){
|
||||||
if (ch == 45) f = 1;
|
if (ch == 45) f = 1;
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
while (ch >= 48 && ch <=57){
|
while (ch >= 48 && ch <=57){
|
||||||
x = x * 10 + ch - 48;
|
x = x * 10 + ch - 48;
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
if (f) return -x;
|
if (f) return -x;
|
||||||
else return x;
|
else return x;
|
||||||
}
|
}
|
||||||
int n, m, fa[100005];
|
int n, m, fa[100005];
|
||||||
void init(){
|
void init(){
|
||||||
int i = 1;
|
int i = 1;
|
||||||
while (i <= n){
|
while (i <= n){
|
||||||
fa[i] = i;
|
fa[i] = i;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int find(int x){
|
int find(int x){
|
||||||
if (fa[x] == x) return x;
|
if (fa[x] == x) return x;
|
||||||
else{
|
else{
|
||||||
int pa = find(fa[x]);
|
int pa = find(fa[x]);
|
||||||
fa[x] = pa;
|
fa[x] = pa;
|
||||||
return pa;
|
return pa;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int same(int x, int y){
|
int same(int x, int y){
|
||||||
if (find(x) == find(y)) return 1;
|
if (find(x) == find(y)) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int main(){
|
int main(){
|
||||||
n = quick_read(); m = quick_read();
|
n = quick_read(); m = quick_read();
|
||||||
init();
|
init();
|
||||||
while (m){
|
while (m){
|
||||||
int ch = getch();
|
int ch = getch();
|
||||||
while (ch != 81 && ch != 85){
|
while (ch != 81 && ch != 85){
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
if (ch == 81){ // query
|
if (ch == 81){ // query
|
||||||
int x = quick_read(), y = quick_read();
|
int x = quick_read(), y = quick_read();
|
||||||
putint(same(x, y));
|
putint(same(x, y));
|
||||||
putch(10);
|
putch(10);
|
||||||
}else{ // union
|
}else{ // union
|
||||||
int x = find(quick_read()), y = find(quick_read());
|
int x = find(quick_read()), y = find(quick_read());
|
||||||
fa[x] = y;
|
fa[x] = y;
|
||||||
}
|
}
|
||||||
m = m - 1;
|
m = m - 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,87 +1,87 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int quick_read(){
|
int quick_read(){
|
||||||
int ch = getch(); int x = 0, f = 0;
|
int ch = getch(); int x = 0, f = 0;
|
||||||
while (ch < 48 || ch > 57){
|
while (ch < 48 || ch > 57){
|
||||||
if (ch == 45) f = 1;
|
if (ch == 45) f = 1;
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
while (ch >= 48 && ch <=57){
|
while (ch >= 48 && ch <=57){
|
||||||
x = x * 10 + ch - 48;
|
x = x * 10 + ch - 48;
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
if (f) return -x;
|
if (f) return -x;
|
||||||
else return x;
|
else return x;
|
||||||
}
|
}
|
||||||
#define maxn 10005
|
#define maxn 10005
|
||||||
int n, m, f[maxn][20], dep[maxn];
|
int n, m, f[maxn][20], dep[maxn];
|
||||||
int to[maxn], next[maxn], head[maxn], cnt = 0;
|
int to[maxn], next[maxn], head[maxn], cnt = 0;
|
||||||
void add_edge(int from, int To){
|
void add_edge(int from, int To){
|
||||||
to[cnt] = To;
|
to[cnt] = To;
|
||||||
next[cnt] = head[from];
|
next[cnt] = head[from];
|
||||||
head[from] = cnt;
|
head[from] = cnt;
|
||||||
cnt = cnt + 1;
|
cnt = cnt + 1;
|
||||||
f[To][0] = from;
|
f[To][0] = from;
|
||||||
}
|
}
|
||||||
void init(){
|
void init(){
|
||||||
dep[0] = 0x3f3f3f3f;
|
dep[0] = 0x3f3f3f3f;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
while (i <= n){
|
while (i <= n){
|
||||||
head[i] = -1;
|
head[i] = -1;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void tree(int x, int d){
|
void tree(int x, int d){
|
||||||
dep[x] = d;
|
dep[x] = d;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (f[x][i]){
|
while (f[x][i]){
|
||||||
f[x][i + 1] = f[f[x][i]][i];
|
f[x][i + 1] = f[f[x][i]][i];
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
i = head[x];
|
i = head[x];
|
||||||
while (i != -1){
|
while (i != -1){
|
||||||
int y = to[i];
|
int y = to[i];
|
||||||
tree(y, d + 1);
|
tree(y, d + 1);
|
||||||
i = next[i];
|
i = next[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int LCA(int x, int y){
|
int LCA(int x, int y){
|
||||||
if (dep[x] < dep[y]){
|
if (dep[x] < dep[y]){
|
||||||
int t = x;
|
int t = x;
|
||||||
x = y;
|
x = y;
|
||||||
y = t;
|
y = t;
|
||||||
}
|
}
|
||||||
int i = 19;
|
int i = 19;
|
||||||
while (dep[x] > dep[y]){
|
while (dep[x] > dep[y]){
|
||||||
if (f[x][i] && dep[f[x][i]] >= dep[y])
|
if (f[x][i] && dep[f[x][i]] >= dep[y])
|
||||||
x = f[x][i];
|
x = f[x][i];
|
||||||
i = i - 1;
|
i = i - 1;
|
||||||
}
|
}
|
||||||
if (x == y) return x;
|
if (x == y) return x;
|
||||||
i = 19;
|
i = 19;
|
||||||
while (i >= 0){
|
while (i >= 0){
|
||||||
if (f[x][i] != f[y][i]){
|
if (f[x][i] != f[y][i]){
|
||||||
x = f[x][i];
|
x = f[x][i];
|
||||||
y = f[y][i];
|
y = f[y][i];
|
||||||
}
|
}
|
||||||
i = i - 1;
|
i = i - 1;
|
||||||
}
|
}
|
||||||
return f[x][0];
|
return f[x][0];
|
||||||
}
|
}
|
||||||
int main(){
|
int main(){
|
||||||
n = quick_read(); m = quick_read();
|
n = quick_read(); m = quick_read();
|
||||||
init();
|
init();
|
||||||
int i = 1;
|
int i = 1;
|
||||||
while (i != n){
|
while (i != n){
|
||||||
int x = quick_read(), y = quick_read();
|
int x = quick_read(), y = quick_read();
|
||||||
add_edge(x, y);
|
add_edge(x, y);
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
tree(1, 1);
|
tree(1, 1);
|
||||||
while (m){
|
while (m){
|
||||||
int x = quick_read(), y = quick_read();
|
int x = quick_read(), y = quick_read();
|
||||||
putint(LCA(x, y));
|
putint(LCA(x, y));
|
||||||
putch(10);
|
putch(10);
|
||||||
m = m - 1;
|
m = m - 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +1,42 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int t[1005][2] = { 0 }, dp[1005][35] = { 0 };
|
int t[1005][2] = { 0 }, dp[1005][35] = { 0 };
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int T, W, x, i, j;
|
int T, W, x, i, j;
|
||||||
T = getint();
|
T = getint();
|
||||||
W = getint();
|
W = getint();
|
||||||
i = 1;
|
i = 1;
|
||||||
while (i <= T) {
|
while (i <= T) {
|
||||||
x = getint();
|
x = getint();
|
||||||
t[i][x % 2] = 1;
|
t[i][x % 2] = 1;
|
||||||
dp[i][0] = dp[i - 1][0] + t[i][1];
|
dp[i][0] = dp[i - 1][0] + t[i][1];
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
while (i <= T) {
|
while (i <= T) {
|
||||||
j = 1;
|
j = 1;
|
||||||
while (j <= W) {
|
while (j <= W) {
|
||||||
if (dp[i - 1][j] + t[i][(j + 1) % 2] > dp[i - 1][j - 1] + t[i][(j + 1) % 2]) {
|
if (dp[i - 1][j] + t[i][(j + 1) % 2] > dp[i - 1][j - 1] + t[i][(j + 1) % 2]) {
|
||||||
dp[i][j] = dp[i - 1][j] + t[i][(j + 1) % 2];
|
dp[i][j] = dp[i - 1][j] + t[i][(j + 1) % 2];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dp[i][j] = dp[i - 1][j - 1] + t[i][(j + 1) % 2];
|
dp[i][j] = dp[i - 1][j - 1] + t[i][(j + 1) % 2];
|
||||||
}
|
}
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int res = 0;
|
int res = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
while (j <= W) {
|
while (j <= W) {
|
||||||
if (res < dp[T][j]) {
|
if (res < dp[T][j]) {
|
||||||
res = dp[T][j];
|
res = dp[T][j];
|
||||||
}
|
}
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,70 +1,70 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#define V 4
|
#define V 4
|
||||||
#define space 32
|
#define space 32
|
||||||
#define LF 10
|
#define LF 10
|
||||||
|
|
||||||
void printSolution(int color[]) {
|
void printSolution(int color[]) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < V) {
|
while (i < V) {
|
||||||
putint(color[i]);
|
putint(color[i]);
|
||||||
putch(space);
|
putch(space);
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
putch(LF);
|
putch(LF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printMessage() {
|
void printMessage() {
|
||||||
putch(78);putch(111);putch(116);
|
putch(78);putch(111);putch(116);
|
||||||
putch(space);
|
putch(space);
|
||||||
putch(101);putch(120);putch(105);putch(115);putch(116);
|
putch(101);putch(120);putch(105);putch(115);putch(116);
|
||||||
}
|
}
|
||||||
|
|
||||||
int isSafe(int graph[][V], int color[]) {
|
int isSafe(int graph[][V], int color[]) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < V) {
|
while (i < V) {
|
||||||
int j = i + 1;
|
int j = i + 1;
|
||||||
while (j < V) {
|
while (j < V) {
|
||||||
if (graph[i][j] && color[j] == color[i])
|
if (graph[i][j] && color[j] == color[i])
|
||||||
return 0;
|
return 0;
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int graphColoring(int graph[][V], int m, int i, int color[]) {
|
int graphColoring(int graph[][V], int m, int i, int color[]) {
|
||||||
if (i == V) {
|
if (i == V) {
|
||||||
if (isSafe(graph, color)) {
|
if (isSafe(graph, color)) {
|
||||||
printSolution(color);
|
printSolution(color);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int j = 1;
|
int j = 1;
|
||||||
while (j <= m) {
|
while (j <= m) {
|
||||||
color[i] = j;
|
color[i] = j;
|
||||||
if (graphColoring(graph, m, i + 1, color))
|
if (graphColoring(graph, m, i + 1, color))
|
||||||
return 1;
|
return 1;
|
||||||
color[i] = 0;
|
color[i] = 0;
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int graph[V][V] = {
|
int graph[V][V] = {
|
||||||
{0, 1, 1, 1},
|
{0, 1, 1, 1},
|
||||||
{1, 0, 1, 0},
|
{1, 0, 1, 0},
|
||||||
{1, 1, 0, 1},
|
{1, 1, 0, 1},
|
||||||
{1, 0, 1, 0}
|
{1, 0, 1, 0}
|
||||||
}, m = 3;
|
}, m = 3;
|
||||||
int color[V], i = 0;
|
int color[V], i = 0;
|
||||||
while (i < V) {
|
while (i < V) {
|
||||||
color[i] = 0;
|
color[i] = 0;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
if (!graphColoring(graph, m, 0, color))
|
if (!graphColoring(graph, m, 0, color))
|
||||||
printMessage();
|
printMessage();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +1,59 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#define maxN 1000
|
#define maxN 1000
|
||||||
#define space 32
|
#define space 32
|
||||||
int array[maxN];
|
int array[maxN];
|
||||||
|
|
||||||
void swap(int i, int j) {
|
void swap(int i, int j) {
|
||||||
int tmp = array[i];
|
int tmp = array[i];
|
||||||
array[i] = array[j];
|
array[i] = array[j];
|
||||||
array[j] = tmp;
|
array[j] = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int findPivot(int start, int end) {
|
int findPivot(int start, int end) {
|
||||||
int pivot = array[end];
|
int pivot = array[end];
|
||||||
|
|
||||||
int pIndex = start, i = start;
|
int pIndex = start, i = start;
|
||||||
while (i < end) {
|
while (i < end) {
|
||||||
if (array[i] <= pivot) {
|
if (array[i] <= pivot) {
|
||||||
swap(i, pIndex);
|
swap(i, pIndex);
|
||||||
pIndex = pIndex + 1;
|
pIndex = pIndex + 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
swap(pIndex, end);
|
swap(pIndex, end);
|
||||||
return pIndex;
|
return pIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void findSmallest(int low, int high, int k, int n) {
|
void findSmallest(int low, int high, int k, int n) {
|
||||||
if (low == high)
|
if (low == high)
|
||||||
return;
|
return;
|
||||||
else {
|
else {
|
||||||
int pIndex = findPivot(low, high);
|
int pIndex = findPivot(low, high);
|
||||||
if (k == pIndex) {
|
if (k == pIndex) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < pIndex) {
|
while (i < pIndex) {
|
||||||
putint(array[i]);
|
putint(array[i]);
|
||||||
putch(space);
|
putch(space);
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (k < pIndex) {
|
else if (k < pIndex) {
|
||||||
findSmallest(low, pIndex - 1, k, n);
|
findSmallest(low, pIndex - 1, k, n);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
findSmallest(pIndex + 1, high, k, n);
|
findSmallest(pIndex + 1, high, k, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int n = getint(), k = getint();
|
int n = getint(), k = getint();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < n) {
|
while (i < n) {
|
||||||
array[i] = getint();
|
array[i] = getint();
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
int low = 0, high = n - 1;
|
int low = 0, high = n - 1;
|
||||||
findSmallest(low, high, k, n);
|
findSmallest(low, high, k, n);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,57 +1,57 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#define maxN 30
|
#define maxN 30
|
||||||
#define maxM 600
|
#define maxM 600
|
||||||
|
|
||||||
int store[maxN], n, m;
|
int store[maxN], n, m;
|
||||||
|
|
||||||
int graph[maxN][maxN];
|
int graph[maxN][maxN];
|
||||||
|
|
||||||
int is_clique(int num) {
|
int is_clique(int num) {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
while (i < num) {
|
while (i < num) {
|
||||||
int j = i + 1;
|
int j = i + 1;
|
||||||
while (j < num) {
|
while (j < num) {
|
||||||
if (graph[store[i]][store[j]] == 0)
|
if (graph[store[i]][store[j]] == 0)
|
||||||
return 0;
|
return 0;
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxCliques(int i, int k) {
|
int maxCliques(int i, int k) {
|
||||||
int max_ = 0;
|
int max_ = 0;
|
||||||
int j = 1;
|
int j = 1;
|
||||||
i = 1;
|
i = 1;
|
||||||
while (j <= n) {
|
while (j <= n) {
|
||||||
store[k] = j;
|
store[k] = j;
|
||||||
if (is_clique(k + 1)) {
|
if (is_clique(k + 1)) {
|
||||||
if (k > max_) max_ = k;
|
if (k > max_) max_ = k;
|
||||||
int tmp = maxCliques(j, k + 1);
|
int tmp = maxCliques(j, k + 1);
|
||||||
if (tmp > max_) max_ = tmp;
|
if (tmp > max_) max_ = tmp;
|
||||||
}
|
}
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
return max_;
|
return max_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
n = getint();
|
n = getint();
|
||||||
m = getint();
|
m = getint();
|
||||||
int edges[maxM][2];
|
int edges[maxM][2];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < m) {
|
while (i < m) {
|
||||||
edges[i][0] = getint();
|
edges[i][0] = getint();
|
||||||
edges[i][1] = getint();
|
edges[i][1] = getint();
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < m) {
|
while (i < m) {
|
||||||
graph[edges[i][0]][edges[i][1]] = 1;
|
graph[edges[i][0]][edges[i][1]] = 1;
|
||||||
graph[edges[i][1]][edges[i][0]] = 1;
|
graph[edges[i][1]][edges[i][0]] = 1;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
putint(maxCliques(0, 1));
|
putint(maxCliques(0, 1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,76 +1,76 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int quick_read(){
|
int quick_read(){
|
||||||
int ch = getch(); int x = 0, f = 0;
|
int ch = getch(); int x = 0, f = 0;
|
||||||
while (ch < 48 || ch > 57){
|
while (ch < 48 || ch > 57){
|
||||||
if (ch == 45) f = 1;
|
if (ch == 45) f = 1;
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
while (ch >= 48 && ch <=57){
|
while (ch >= 48 && ch <=57){
|
||||||
x = x * 10 + ch - 48;
|
x = x * 10 + ch - 48;
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
if (f) return -x;
|
if (f) return -x;
|
||||||
else return x;
|
else return x;
|
||||||
}
|
}
|
||||||
#define maxm 1005
|
#define maxm 1005
|
||||||
#define maxn 105
|
#define maxn 105
|
||||||
int n, m;
|
int n, m;
|
||||||
int u[maxm], v[maxm], c[maxm], fa[maxm];
|
int u[maxm], v[maxm], c[maxm], fa[maxm];
|
||||||
int find(int x){
|
int find(int x){
|
||||||
if (x == fa[x]) return x;
|
if (x == fa[x]) return x;
|
||||||
int asdf = find(fa[x]);
|
int asdf = find(fa[x]);
|
||||||
fa[x] = asdf;
|
fa[x] = asdf;
|
||||||
return asdf;
|
return asdf;
|
||||||
}
|
}
|
||||||
int same(int x, int y){
|
int same(int x, int y){
|
||||||
x = find(x);
|
x = find(x);
|
||||||
y = find(y);
|
y = find(y);
|
||||||
if (x == y) return 1;
|
if (x == y) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int prim(){
|
int prim(){
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < m){
|
while (i < m){
|
||||||
int j = i + 1;
|
int j = i + 1;
|
||||||
while (j < m){
|
while (j < m){
|
||||||
if (c[i] > c[j]){
|
if (c[i] > c[j]){
|
||||||
int t = u[i];
|
int t = u[i];
|
||||||
u[i] = u[j];
|
u[i] = u[j];
|
||||||
u[j] = t;
|
u[j] = t;
|
||||||
t = v[i];
|
t = v[i];
|
||||||
v[i] = v[j];
|
v[i] = v[j];
|
||||||
v[j] = t;
|
v[j] = t;
|
||||||
t = c[i];
|
t = c[i];
|
||||||
c[i] = c[j];
|
c[i] = c[j];
|
||||||
c[j] = t;
|
c[j] = t;
|
||||||
}
|
}
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
i = 1;
|
i = 1;
|
||||||
while (i <= n){
|
while (i <= n){
|
||||||
fa[i] = i;
|
fa[i] = i;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
while (i < m){
|
while (i < m){
|
||||||
if (same(u[i], v[i])) continue;
|
if (same(u[i], v[i])) continue;
|
||||||
res = res + c[i];
|
res = res + c[i];
|
||||||
fa[find(u[i])]=v[i];
|
fa[find(u[i])]=v[i];
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
int main(){
|
int main(){
|
||||||
int n = quick_read(), m = quick_read();
|
int n = quick_read(), m = quick_read();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < m){
|
while (i < m){
|
||||||
u[i] = quick_read();
|
u[i] = quick_read();
|
||||||
v[i] = quick_read();
|
v[i] = quick_read();
|
||||||
c[i] = quick_read();
|
c[i] = quick_read();
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
return prim();
|
return prim();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,90 +1,90 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#define INF 1073741824
|
#define INF 1073741824
|
||||||
int a[30][30];
|
int a[30][30];
|
||||||
int step[4][2] = { {1,0},{-1,0},{0,1},{0,-1} };
|
int step[4][2] = { {1,0},{-1,0},{0,1},{0,-1} };
|
||||||
int w, h, x_0, y_0, x_1, y_1;
|
int w, h, x_0, y_0, x_1, y_1;
|
||||||
|
|
||||||
int search(int x, int y, int n)
|
int search(int x, int y, int n)
|
||||||
{
|
{
|
||||||
if (n > 10)
|
if (n > 10)
|
||||||
return INF;
|
return INF;
|
||||||
int num = INF;
|
int num = INF;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < 4) {
|
while (i < 4) {
|
||||||
int coun = 0;
|
int coun = 0;
|
||||||
int x2 = x, y2 = y;
|
int x2 = x, y2 = y;
|
||||||
while (a[x2][y2] != 1) {
|
while (a[x2][y2] != 1) {
|
||||||
if (x2 == x_1 && y2 == y_1) break;
|
if (x2 == x_1 && y2 == y_1) break;
|
||||||
x2 = x2 + step[i][0];
|
x2 = x2 + step[i][0];
|
||||||
y2 = y2 + step[i][1];
|
y2 = y2 + step[i][1];
|
||||||
coun = coun + 1;
|
coun = coun + 1;
|
||||||
}
|
}
|
||||||
if (x2 == x_1 && y2 == y_1)
|
if (x2 == x_1 && y2 == y_1)
|
||||||
return 1;
|
return 1;
|
||||||
if (coun <= 1) {
|
if (coun <= 1) {
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (x2 == 0 || x2 == h + 1 || y2 == 0 || y2 == w + 1) {
|
if (x2 == 0 || x2 == h + 1 || y2 == 0 || y2 == w + 1) {
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
a[x2][y2] = 0;
|
a[x2][y2] = 0;
|
||||||
int searchResult = search(x2 - step[i][0], y2 - step[i][1], n + 1) + 1;
|
int searchResult = search(x2 - step[i][0], y2 - step[i][1], n + 1) + 1;
|
||||||
if (searchResult < num)
|
if (searchResult < num)
|
||||||
num = searchResult;
|
num = searchResult;
|
||||||
a[x2][y2] = 1;
|
a[x2][y2] = 1;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num > 10)
|
if (num > 10)
|
||||||
return INF;
|
return INF;
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
w = getint();
|
w = getint();
|
||||||
h = getint();
|
h = getint();
|
||||||
while (w != 0) {
|
while (w != 0) {
|
||||||
int i, j;
|
int i, j;
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < 30) {
|
while (i < 30) {
|
||||||
j = 0;
|
j = 0;
|
||||||
while (j < 30) {
|
while (j < 30) {
|
||||||
a[i][j] = 1;
|
a[i][j] = 1;
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
i = 1;
|
i = 1;
|
||||||
while (i <= h) {
|
while (i <= h) {
|
||||||
j = 1;
|
j = 1;
|
||||||
while (j <= w) {
|
while (j <= w) {
|
||||||
a[i][j] = getint();
|
a[i][j] = getint();
|
||||||
if (a[i][j] == 2) {
|
if (a[i][j] == 2) {
|
||||||
x_0 = i;
|
x_0 = i;
|
||||||
y_0 = j;
|
y_0 = j;
|
||||||
}
|
}
|
||||||
else if (a[i][j] == 3) {
|
else if (a[i][j] == 3) {
|
||||||
x_1 = i;
|
x_1 = i;
|
||||||
y_1 = j;
|
y_1 = j;
|
||||||
}
|
}
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
int res = search(x_0, y_0, 1);
|
int res = search(x_0, y_0, 1);
|
||||||
if (res <= 10) {
|
if (res <= 10) {
|
||||||
putint(res);
|
putint(res);
|
||||||
putch(10);
|
putch(10);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
putint(-1);
|
putint(-1);
|
||||||
putch(10);
|
putch(10);
|
||||||
}
|
}
|
||||||
w = getint();
|
w = getint();
|
||||||
h = getint();
|
h = getint();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,93 +1,93 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int quick_read(){
|
int quick_read(){
|
||||||
int ch = getch(); int x = 0, f = 0;
|
int ch = getch(); int x = 0, f = 0;
|
||||||
while (ch < 48 || ch > 57){
|
while (ch < 48 || ch > 57){
|
||||||
if (ch == 45) f = 1;
|
if (ch == 45) f = 1;
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
while (ch >= 48 && ch <=57){
|
while (ch >= 48 && ch <=57){
|
||||||
x = x * 10 + ch - 48;
|
x = x * 10 + ch - 48;
|
||||||
ch = getch();
|
ch = getch();
|
||||||
}
|
}
|
||||||
if (f) return -x;
|
if (f) return -x;
|
||||||
else return x;
|
else return x;
|
||||||
}
|
}
|
||||||
int n;
|
int n;
|
||||||
#define maxn 100005
|
#define maxn 100005
|
||||||
void sortA(int a[]){
|
void sortA(int a[]){
|
||||||
int i = 0, j;
|
int i = 0, j;
|
||||||
while (i < n){
|
while (i < n){
|
||||||
j = i + 1;
|
j = i + 1;
|
||||||
while (j < n){
|
while (j < n){
|
||||||
if (a[i] > a[j]){
|
if (a[i] > a[j]){
|
||||||
int t = a[i];
|
int t = a[i];
|
||||||
a[i] = a[j];
|
a[i] = a[j];
|
||||||
a[j] = t;
|
a[j] = t;
|
||||||
}
|
}
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int cnt[maxn*4];
|
int cnt[maxn*4];
|
||||||
void sortB(int a[]){
|
void sortB(int a[]){
|
||||||
int i = 0, mx = -100;
|
int i = 0, mx = -100;
|
||||||
while (i < n){
|
while (i < n){
|
||||||
cnt[a[i]] = cnt[a[i]] + 1;
|
cnt[a[i]] = cnt[a[i]] + 1;
|
||||||
if (a[i] > mx) mx = a[i];
|
if (a[i] > mx) mx = a[i];
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
i = 0; int now = 0;
|
i = 0; int now = 0;
|
||||||
while (i <= mx){
|
while (i <= mx){
|
||||||
int j = cnt[i];
|
int j = cnt[i];
|
||||||
while (j){
|
while (j){
|
||||||
a[now] = i;
|
a[now] = i;
|
||||||
now = now + 1;
|
now = now + 1;
|
||||||
j = j - 1;
|
j = j - 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void sortC(int a[]){
|
void sortC(int a[]){
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < n){
|
while (i < n){
|
||||||
int id = i, j = i + 1;
|
int id = i, j = i + 1;
|
||||||
while (j < n){
|
while (j < n){
|
||||||
if (a[j] < a[id])
|
if (a[j] < a[id])
|
||||||
id = j;
|
id = j;
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
int t = a[i];
|
int t = a[i];
|
||||||
a[i] = a[id];
|
a[i] = a[id];
|
||||||
a[id] = t;
|
a[id] = t;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int x[maxn];
|
int x[maxn];
|
||||||
int a[maxn], b[maxn], c[maxn];
|
int a[maxn], b[maxn], c[maxn];
|
||||||
int main(){
|
int main(){
|
||||||
n = quick_read();
|
n = quick_read();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i != n){
|
while (i != n){
|
||||||
a[i] = quick_read();
|
a[i] = quick_read();
|
||||||
b[i] = a[i];
|
b[i] = a[i];
|
||||||
c[i] = b[i];
|
c[i] = b[i];
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
sortA(a);
|
sortA(a);
|
||||||
sortB(b);
|
sortB(b);
|
||||||
sortC(c);
|
sortC(c);
|
||||||
i = 0;
|
i = 0;
|
||||||
while (n - i){
|
while (n - i){
|
||||||
b[i] = b[i] - a[i];
|
b[i] = b[i] - a[i];
|
||||||
c[i] = c[i] - b[i] - a[i];
|
c[i] = c[i] - b[i] - a[i];
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i - n){
|
while (i - n){
|
||||||
if (b[i]) return 1;
|
if (b[i]) return 1;
|
||||||
if (c[i]) return 2;
|
if (c[i]) return 2;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
return -123;
|
return -123;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,48 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#define maxN 1005
|
#define maxN 1005
|
||||||
int parent[maxN];
|
int parent[maxN];
|
||||||
|
|
||||||
int find(int root) {
|
int find(int root) {
|
||||||
if (parent[root] == root)
|
if (parent[root] == root)
|
||||||
return root;
|
return root;
|
||||||
else {
|
else {
|
||||||
parent[root] = find(parent[root]);
|
parent[root] = find(parent[root]);
|
||||||
return parent[root];
|
return parent[root];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void merge(int p, int q) {
|
void merge(int p, int q) {
|
||||||
int root_p, root_q;
|
int root_p, root_q;
|
||||||
root_p = find(p);
|
root_p = find(p);
|
||||||
root_q = find(q);
|
root_q = find(q);
|
||||||
if (root_p != root_q) {
|
if (root_p != root_q) {
|
||||||
parent[root_q] = root_p;
|
parent[root_q] = root_p;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int n = getint(), m = getint(), i;
|
int n = getint(), m = getint(), i;
|
||||||
int p, q;
|
int p, q;
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < n) {
|
while (i < n) {
|
||||||
parent[i] = i;
|
parent[i] = i;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < m) {
|
while (i < m) {
|
||||||
p = getint();
|
p = getint();
|
||||||
q = getint();
|
q = getint();
|
||||||
merge(p, q);
|
merge(p, q);
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int clusters = 0;
|
int clusters = 0;
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < n) {
|
while (i < n) {
|
||||||
if (parent[i] == i) clusters = clusters + 1;
|
if (parent[i] == i) clusters = clusters + 1;
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
putint(clusters);
|
putint(clusters);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,61 +1,61 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#define MAX_SIZE 100
|
#define MAX_SIZE 100
|
||||||
int a[MAX_SIZE][MAX_SIZE], b[MAX_SIZE][MAX_SIZE];
|
int a[MAX_SIZE][MAX_SIZE], b[MAX_SIZE][MAX_SIZE];
|
||||||
int res[MAX_SIZE][MAX_SIZE];
|
int res[MAX_SIZE][MAX_SIZE];
|
||||||
int n1, m1, n2, m2;
|
int n1, m1, n2, m2;
|
||||||
void matrix_multiply() {
|
void matrix_multiply() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < m1) {
|
while (i < m1) {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
while (j < n2) {
|
while (j < n2) {
|
||||||
int k = 0;
|
int k = 0;
|
||||||
while (k < n1) {
|
while (k < n1) {
|
||||||
res[i][j] = res[i][j] + a[i][k] * b[k][j];
|
res[i][j] = res[i][j] + a[i][k] * b[k][j];
|
||||||
k = k + 1;
|
k = k + 1;
|
||||||
}
|
}
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
m1 = getint();
|
m1 = getint();
|
||||||
n1 = getint();
|
n1 = getint();
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < m1) {
|
while (i < m1) {
|
||||||
j = 0;
|
j = 0;
|
||||||
while (j < n1) {
|
while (j < n1) {
|
||||||
a[i][j] = getint();
|
a[i][j] = getint();
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
m2 = getint();
|
m2 = getint();
|
||||||
n2 = getint();
|
n2 = getint();
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < m2) {
|
while (i < m2) {
|
||||||
j = 0;
|
j = 0;
|
||||||
while (j < n2) {
|
while (j < n2) {
|
||||||
b[i][j] = getint();
|
b[i][j] = getint();
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
matrix_multiply();
|
matrix_multiply();
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < m1) {
|
while (i < m1) {
|
||||||
j = 0;
|
j = 0;
|
||||||
while (j < n2) {
|
while (j < n2) {
|
||||||
putint(res[i][j]);
|
putint(res[i][j]);
|
||||||
putch(32);
|
putch(32);
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
putch(10);
|
putch(10);
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,114 +1,114 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int a;
|
int a;
|
||||||
int sum;
|
int sum;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
int getA() {
|
int getA() {
|
||||||
count = count + 1;
|
count = count + 1;
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void f1(int a) {
|
void f1(int a) {
|
||||||
sum = sum + a;
|
sum = sum + a;
|
||||||
a = getA();
|
a = getA();
|
||||||
sum = sum + a;
|
sum = sum + a;
|
||||||
{
|
{
|
||||||
if (1) {
|
if (1) {
|
||||||
int a = getA();
|
int a = getA();
|
||||||
sum = sum + a;
|
sum = sum + a;
|
||||||
}
|
}
|
||||||
sum = sum + a;
|
sum = sum + a;
|
||||||
}
|
}
|
||||||
sum = sum + a;
|
sum = sum + a;
|
||||||
}
|
}
|
||||||
|
|
||||||
void f2() {
|
void f2() {
|
||||||
sum = sum + a;
|
sum = sum + a;
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
int a = getA();
|
int a = getA();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sum = sum + a;
|
sum = sum + a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void f3() {
|
void f3() {
|
||||||
int a = getA();
|
int a = getA();
|
||||||
sum = sum + a;
|
sum = sum + a;
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
a = getA();
|
a = getA();
|
||||||
}
|
}
|
||||||
sum = sum + a;
|
sum = sum + a;
|
||||||
int a = getA();
|
int a = getA();
|
||||||
}
|
}
|
||||||
sum = sum + a;
|
sum = sum + a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
sum = 0;
|
sum = 0;
|
||||||
a = getA();
|
a = getA();
|
||||||
sum = sum + a;
|
sum = sum + a;
|
||||||
int a = getA();
|
int a = getA();
|
||||||
f1(a);f2();f3();
|
f1(a);f2();f3();
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
f1(a);f2();f3();
|
f1(a);f2();f3();
|
||||||
int a = getA();
|
int a = getA();
|
||||||
}
|
}
|
||||||
f1(a);f2();f3();
|
f1(a);f2();f3();
|
||||||
{
|
{
|
||||||
int a = getA();
|
int a = getA();
|
||||||
{
|
{
|
||||||
int a = getA();
|
int a = getA();
|
||||||
{
|
{
|
||||||
f1(a);f2();f3();
|
f1(a);f2();f3();
|
||||||
int a = getA();
|
int a = getA();
|
||||||
f1(a);f2();f3();
|
f1(a);f2();f3();
|
||||||
{
|
{
|
||||||
a = getA();
|
a = getA();
|
||||||
}
|
}
|
||||||
f1(a);f2();f3();
|
f1(a);f2();f3();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f1(a);f2();f3();
|
f1(a);f2();f3();
|
||||||
}
|
}
|
||||||
while(1) {
|
while(1) {
|
||||||
while(1) {
|
while(1) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(i < 3) {
|
while(i < 3) {
|
||||||
while(1) {
|
while(1) {
|
||||||
if (1) {
|
if (1) {
|
||||||
f1(a);f2();f3();
|
f1(a);f2();f3();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
a = getA();
|
a = getA();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
int a = getA();
|
int a = getA();
|
||||||
f1(a);f2();f3();
|
f1(a);f2();f3();
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
f1(a);f2();f3();
|
f1(a);f2();f3();
|
||||||
}
|
}
|
||||||
a = getA();
|
a = getA();
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
putint(sum);
|
putint(sum);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,62 +1,62 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
int array[20];
|
int array[20];
|
||||||
|
|
||||||
int f(int i, int j) {
|
int f(int i, int j) {
|
||||||
sum = sum + 1;
|
sum = sum + 1;
|
||||||
if (i >= j || i >= 20) return 0;
|
if (i >= j || i >= 20) return 0;
|
||||||
array[i] = 1;
|
array[i] = 1;
|
||||||
if (i == 0) return array[0];
|
if (i == 0) return array[0];
|
||||||
else return array[i - 1];
|
else return array[i - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
int g(int i, int j) {
|
int g(int i, int j) {
|
||||||
sum = sum + 2;
|
sum = sum + 2;
|
||||||
if (i >= j || i >= 20) return 1;
|
if (i >= j || i >= 20) return 1;
|
||||||
array[i] = 0;
|
array[i] = 0;
|
||||||
if (i == 0) return array[0];
|
if (i == 0) return array[0];
|
||||||
else return array[i - 1];
|
else return array[i - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
int h(int i) {
|
int h(int i) {
|
||||||
sum = sum + 3;
|
sum = sum + 3;
|
||||||
if (i < 0 || i >= 20) return 0;
|
if (i < 0 || i >= 20) return 0;
|
||||||
return array[i];
|
return array[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < 20) {
|
while (i < 20) {
|
||||||
if (f(0, i) && f(1, i) && f(2, i) && f(3, i) && f(4, i) && f(5, i) &&
|
if (f(0, i) && f(1, i) && f(2, i) && f(3, i) && f(4, i) && f(5, i) &&
|
||||||
f(6, i) && f(7, i) && f(8, i) && f(9, i) && f(10, i) && f(11, i) &&
|
f(6, i) && f(7, i) && f(8, i) && f(9, i) && f(10, i) && f(11, i) &&
|
||||||
f(12, i) && f(13, i) && f(14, i) && f(15, i) && f(16, i) && f(17, i) &&
|
f(12, i) && f(13, i) && f(14, i) && f(15, i) && f(16, i) && f(17, i) &&
|
||||||
f(18, i) && f(19, i));
|
f(18, i) && f(19, i));
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < 20) {
|
while (i < 20) {
|
||||||
if (g(0, i) || g(1, i) || g(2, i) || g(3, i) || g(4, i) || g(5, i) ||
|
if (g(0, i) || g(1, i) || g(2, i) || g(3, i) || g(4, i) || g(5, i) ||
|
||||||
g(6, i) || g(7, i) || g(8, i) || g(9, i) || g(10, i) || g(11, i) ||
|
g(6, i) || g(7, i) || g(8, i) || g(9, i) || g(10, i) || g(11, i) ||
|
||||||
g(12, i) || g(13, i) || g(14, i) || g(15, i) || g(16, i) || g(17, i) ||
|
g(12, i) || g(13, i) || g(14, i) || g(15, i) || g(16, i) || g(17, i) ||
|
||||||
g(18, i) || g(19, i));
|
g(18, i) || g(19, i));
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
i = 1;
|
i = 1;
|
||||||
while (i < 20 && f(i - 1, i))
|
while (i < 20 && f(i - 1, i))
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
|
|
||||||
int ans;
|
int ans;
|
||||||
ans = 0;
|
ans = 0;
|
||||||
if (h(0) && h(1) || !h(2) || h(3)) ans = 1;
|
if (h(0) && h(1) || !h(2) || h(3)) ans = 1;
|
||||||
sum + ans;
|
sum + ans;
|
||||||
ans = 0;
|
ans = 0;
|
||||||
if (!h(4) || h(5) && !h(6) && h(7) || !h(8)) ans = 1;
|
if (!h(4) || h(5) && !h(6) && h(7) || !h(8)) ans = 1;
|
||||||
sum * ans;
|
sum * ans;
|
||||||
ans = 0;
|
ans = 0;
|
||||||
if (h(9) && !h(10) || !h(11) || !h(12) || !h(13) || h(14) && h(15)) ans = 1;
|
if (h(9) && !h(10) || !h(11) || !h(12) || !h(13) || h(14) && h(15)) ans = 1;
|
||||||
sum - ans;
|
sum - ans;
|
||||||
ans = 0;
|
ans = 0;
|
||||||
if (h(0) && h(2) && !h(3) && !h(4) || h(5) || h(6) && !h(7) || h(8)) ans = 1;
|
if (h(0) && h(2) && !h(3) && !h(4) || h(5) || h(6) && !h(7) || h(8)) ans = 1;
|
||||||
putint(sum + ans);
|
putint(sum + ans);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,130 +1,130 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int sum(int a0[], int a1[][2], int a2[][2][2], int a3[][2][2][2], int a4[][2][2][2][2],
|
int sum(int a0[], int a1[][2], int a2[][2][2], int a3[][2][2][2], int a4[][2][2][2][2],
|
||||||
int a5[][2][2][2][2][2], int a6[][2][2][2][2][2][2], int a7[][2][2][2][2][2][2][2],
|
int a5[][2][2][2][2][2], int a6[][2][2][2][2][2][2], int a7[][2][2][2][2][2][2][2],
|
||||||
int a8[][2][2][2][2][2][2][2][2], int a9[][2][2][2][2][2][2][2][2][2], int a10[][2][2][2][2][2][2][2][2][2][2],
|
int a8[][2][2][2][2][2][2][2][2], int a9[][2][2][2][2][2][2][2][2][2], int a10[][2][2][2][2][2][2][2][2][2][2],
|
||||||
int a11[][2][2][2][2][2][2][2][2][2][2][2], int a12[][2][2][2][2][2][2][2][2][2][2][2][2], int a13[][2][2][2][2][2][2][2][2][2][2][2][2][2],
|
int a11[][2][2][2][2][2][2][2][2][2][2][2], int a12[][2][2][2][2][2][2][2][2][2][2][2][2], int a13[][2][2][2][2][2][2][2][2][2][2][2][2][2],
|
||||||
int a14[][2][2][2][2][2][2][2][2][2][2][2][2][2][2], int a15[][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2], int a16[][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2],
|
int a14[][2][2][2][2][2][2][2][2][2][2][2][2][2][2], int a15[][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2], int a16[][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2],
|
||||||
int a17[][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2], int a18[][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2]) {
|
int a17[][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2], int a18[][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2]) {
|
||||||
return a0[0] +
|
return a0[0] +
|
||||||
a1[1][0] +
|
a1[1][0] +
|
||||||
a2[0][0][1] +
|
a2[0][0][1] +
|
||||||
a3[1][0][1][0] +
|
a3[1][0][1][0] +
|
||||||
a4[0][0][1][1][0] +
|
a4[0][0][1][1][0] +
|
||||||
a5[1][1][1][0][0][1] +
|
a5[1][1][1][0][0][1] +
|
||||||
a6[0][0][0][1][1][1][0] +
|
a6[0][0][0][1][1][1][0] +
|
||||||
a7[1][1][1][1][0][0][0][1] +
|
a7[1][1][1][1][0][0][0][1] +
|
||||||
a8[0][0][0][1][1][1][0][0][0] +
|
a8[0][0][0][1][1][1][0][0][0] +
|
||||||
a9[0][0][1][1][0][0][1][0][0][1] +
|
a9[0][0][1][1][0][0][1][0][0][1] +
|
||||||
a10[0][0][1][1][1][1][1][0][0][1][1] +
|
a10[0][0][1][1][1][1][1][0][0][1][1] +
|
||||||
a11[0][0][1][1][0][0][1][0][0][1][1][0] +
|
a11[0][0][1][1][0][0][1][0][0][1][1][0] +
|
||||||
a12[1][1][0][0][1][1][1][0][0][1][0][0][0] +
|
a12[1][1][0][0][1][1][1][0][0][1][0][0][0] +
|
||||||
a13[0][0][0][0][0][0][0][1][1][1][1][1][1][1] +
|
a13[0][0][0][0][0][0][0][1][1][1][1][1][1][1] +
|
||||||
a14[0][0][0][0][0][0][0][0][0][0][1][1][1][1][1]+
|
a14[0][0][0][0][0][0][0][0][0][0][1][1][1][1][1]+
|
||||||
a15[1][1][1][1][0][0][0][0][1][1][1][0][0][1][0][0] +
|
a15[1][1][1][1][0][0][0][0][1][1][1][0][0][1][0][0] +
|
||||||
a16[0][0][0][0][0][1][1][1][1][1][0][0][1][0][1][0][1] +
|
a16[0][0][0][0][0][1][1][1][1][1][0][0][1][0][1][0][1] +
|
||||||
a17[1][1][0][0][1][0][1][0][0][0][1][1][1][1][0][0][1][1] +
|
a17[1][1][0][0][1][0][1][0][0][0][1][1][1][1][0][0][1][1] +
|
||||||
a18[0][0][1][0][0][0][1][0][0][1][1][0][0][0][0][0][0][0][0];
|
a18[0][0][1][0][0][0][1][0][0][1][1][0][0][0][0][0][0][0][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int array[2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2] = {0};
|
int array[2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2] = {0};
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int i0 = 0;
|
int i0 = 0;
|
||||||
while (i0 < 2) {
|
while (i0 < 2) {
|
||||||
int i1 = 0;
|
int i1 = 0;
|
||||||
while (i1 < 2) {
|
while (i1 < 2) {
|
||||||
int i2 = 0;
|
int i2 = 0;
|
||||||
while (i2 < 2) {
|
while (i2 < 2) {
|
||||||
int i3 = 0;
|
int i3 = 0;
|
||||||
while (i3 < 2) {
|
while (i3 < 2) {
|
||||||
int i4 = 0;
|
int i4 = 0;
|
||||||
while (i4 < 2) {
|
while (i4 < 2) {
|
||||||
int i5 = 0;
|
int i5 = 0;
|
||||||
while (i5 < 2) {
|
while (i5 < 2) {
|
||||||
int i6 = 0;
|
int i6 = 0;
|
||||||
while (i6 < 2) {
|
while (i6 < 2) {
|
||||||
int i7 = 0;
|
int i7 = 0;
|
||||||
while (i7 < 2) {
|
while (i7 < 2) {
|
||||||
int i8 = 0;
|
int i8 = 0;
|
||||||
while (i8 < 2) {
|
while (i8 < 2) {
|
||||||
int i9 = 0;
|
int i9 = 0;
|
||||||
while (i9 < 2) {
|
while (i9 < 2) {
|
||||||
int i10 = 0;
|
int i10 = 0;
|
||||||
while (i10 < 2) {
|
while (i10 < 2) {
|
||||||
int i11 = 0;
|
int i11 = 0;
|
||||||
while (i11 < 2) {
|
while (i11 < 2) {
|
||||||
int i12 = 0;
|
int i12 = 0;
|
||||||
while (i12 < 2) {
|
while (i12 < 2) {
|
||||||
int i13 = 0;
|
int i13 = 0;
|
||||||
while (i13 < 2) {
|
while (i13 < 2) {
|
||||||
int i14 = 0;
|
int i14 = 0;
|
||||||
while (i14 < 2) {
|
while (i14 < 2) {
|
||||||
int i15 = 0;
|
int i15 = 0;
|
||||||
while (i15 < 2) {
|
while (i15 < 2) {
|
||||||
int i16 = 0;
|
int i16 = 0;
|
||||||
while (i16 < 2) {
|
while (i16 < 2) {
|
||||||
int i17 = 0;
|
int i17 = 0;
|
||||||
while (i17 < 2) {
|
while (i17 < 2) {
|
||||||
int i18 = 0;
|
int i18 = 0;
|
||||||
while (i18 < 2) {
|
while (i18 < 2) {
|
||||||
array[i0][i1][i2][i3][i4][i5][i6][i7][i8][i9][i10][i11][i12][i13][i14][i15][i16][i17][i18] = count;
|
array[i0][i1][i2][i3][i4][i5][i6][i7][i8][i9][i10][i11][i12][i13][i14][i15][i16][i17][i18] = count;
|
||||||
count = count + 1;
|
count = count + 1;
|
||||||
i18 = i18 + 1;
|
i18 = i18 + 1;
|
||||||
}
|
}
|
||||||
i17 = i17 + 1;
|
i17 = i17 + 1;
|
||||||
}
|
}
|
||||||
i16 = i16 + 1;
|
i16 = i16 + 1;
|
||||||
}
|
}
|
||||||
i15 = i15 + 1;
|
i15 = i15 + 1;
|
||||||
}
|
}
|
||||||
i14 = i14 + 1;
|
i14 = i14 + 1;
|
||||||
}
|
}
|
||||||
i13 = i13 + 1;
|
i13 = i13 + 1;
|
||||||
}
|
}
|
||||||
i12 = i12 + 1;
|
i12 = i12 + 1;
|
||||||
}
|
}
|
||||||
i11 = i11 + 1;
|
i11 = i11 + 1;
|
||||||
}
|
}
|
||||||
i10 = i10 + 1;
|
i10 = i10 + 1;
|
||||||
}
|
}
|
||||||
i9 = i9 + 1;
|
i9 = i9 + 1;
|
||||||
}
|
}
|
||||||
i8 = i8 + 1;
|
i8 = i8 + 1;
|
||||||
}
|
}
|
||||||
i7 = i7 + 1;
|
i7 = i7 + 1;
|
||||||
}
|
}
|
||||||
i6 = i6 + 1;
|
i6 = i6 + 1;
|
||||||
}
|
}
|
||||||
i5 = i5 + 1;
|
i5 = i5 + 1;
|
||||||
}
|
}
|
||||||
i4 = i4 + 1;
|
i4 = i4 + 1;
|
||||||
}
|
}
|
||||||
i3 = i3 + 1;
|
i3 = i3 + 1;
|
||||||
}
|
}
|
||||||
i2 = i2 + 1;
|
i2 = i2 + 1;
|
||||||
}
|
}
|
||||||
i1 = i1 + 1;
|
i1 = i1 + 1;
|
||||||
}
|
}
|
||||||
i0 = i0 + 1;
|
i0 = i0 + 1;
|
||||||
}
|
}
|
||||||
putint(sum(array[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0],
|
putint(sum(array[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0],
|
||||||
array[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0],
|
array[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0],
|
||||||
array[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0],
|
array[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0],
|
||||||
array[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0],
|
array[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0],
|
||||||
array[0][0][0][0][0][0][0][0][0][0][0][0][0][0],
|
array[0][0][0][0][0][0][0][0][0][0][0][0][0][0],
|
||||||
array[0][0][0][0][0][0][0][0][0][0][0][0][0],
|
array[0][0][0][0][0][0][0][0][0][0][0][0][0],
|
||||||
array[0][0][0][0][0][0][0][0][0][0][0][0],
|
array[0][0][0][0][0][0][0][0][0][0][0][0],
|
||||||
array[0][0][0][0][0][0][0][0][0][0][0],
|
array[0][0][0][0][0][0][0][0][0][0][0],
|
||||||
array[0][0][0][0][0][0][0][0][0][0],
|
array[0][0][0][0][0][0][0][0][0][0],
|
||||||
array[0][0][0][0][0][0][0][0][0],
|
array[0][0][0][0][0][0][0][0][0],
|
||||||
array[0][0][0][0][0][0][0][0],
|
array[0][0][0][0][0][0][0][0],
|
||||||
array[0][0][0][0][0][0][0],
|
array[0][0][0][0][0][0][0],
|
||||||
array[0][0][0][0][0][0],
|
array[0][0][0][0][0][0],
|
||||||
array[0][0][0][0][0],
|
array[0][0][0][0][0],
|
||||||
array[0][0][0][0],
|
array[0][0][0][0],
|
||||||
array[0][0][0],
|
array[0][0][0],
|
||||||
array[0][0],
|
array[0][0],
|
||||||
array[0],
|
array[0],
|
||||||
array));
|
array));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#define N 100
|
#define N 100
|
||||||
#define M 20
|
#define M 20
|
||||||
int array[M][N];
|
int array[M][N];
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int i = 0, sum = 0;
|
int i = 0, sum = 0;
|
||||||
while (i < M) {
|
while (i < M) {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
while (j < N) {
|
while (j < N) {
|
||||||
array[i][j] = j;
|
array[i][j] = j;
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
sum =
|
sum =
|
||||||
array[0][array[1][array[2][array[3][array[4][array[5][array[6][array[7][array[8][
|
array[0][array[1][array[2][array[3][array[4][array[5][array[6][array[7][array[8][
|
||||||
array[9][array[10][array[11][array[12][array[13][array[14][array[15][array[16][
|
array[9][array[10][array[11][array[12][array[13][array[14][array[15][array[16][
|
||||||
array[17][array[18][array[19][23]]]
|
array[17][array[18][array[19][23]]]
|
||||||
]]]]]]]]
|
]]]]]]]]
|
||||||
]]]]]]]]]
|
]]]]]]]]]
|
||||||
+
|
+
|
||||||
array[array[array[array[array[array[array[array[array[array[array[array[array
|
array[array[array[array[array[array[array[array[array[array[array[array[array
|
||||||
[array[array[array[array[array[array[array[19][18]]
|
[array[array[array[array[array[array[array[19][18]]
|
||||||
[17]][16]][15]][14]][13]][12]][11]][10]][9]][8]][7]]
|
[17]][16]][15]][14]][13]][12]][11]][10]][9]][8]][7]]
|
||||||
[6]][5]][4]][3]][2]][1]][0]][56];
|
[6]][5]][4]][3]][2]][1]][0]][56];
|
||||||
putint(sum);
|
putint(sum);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,81 +1,81 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int func(int aa, int ab, int ac, int ad, int ae, int af, int ag, int ah, int ai, int aj, int ak, int al, int am, int an, int ao, int ap, int aq, int ar, int as, int at, int au, int av, int aw, int ax, int ay, int az,
|
int func(int aa, int ab, int ac, int ad, int ae, int af, int ag, int ah, int ai, int aj, int ak, int al, int am, int an, int ao, int ap, int aq, int ar, int as, int at, int au, int av, int aw, int ax, int ay, int az,
|
||||||
int ba, int bb, int bc, int bd, int be, int bf, int bg, int bh, int bi, int bj, int bk, int bl, int bm, int bn, int bo, int bp, int bq, int br, int bs, int bt, int bu, int bv, int bw, int bx, int by, int bz,
|
int ba, int bb, int bc, int bd, int be, int bf, int bg, int bh, int bi, int bj, int bk, int bl, int bm, int bn, int bo, int bp, int bq, int br, int bs, int bt, int bu, int bv, int bw, int bx, int by, int bz,
|
||||||
int ca, int cb, int cc, int cd, int ce, int cf, int cg, int ch, int ci, int cj, int ck, int cl, int cm, int cn, int co, int cp, int cq, int cr, int cs, int ct, int cu, int cv, int cw, int cx, int cy, int cz,
|
int ca, int cb, int cc, int cd, int ce, int cf, int cg, int ch, int ci, int cj, int ck, int cl, int cm, int cn, int co, int cp, int cq, int cr, int cs, int ct, int cu, int cv, int cw, int cx, int cy, int cz,
|
||||||
int da, int db, int dc, int dd, int de, int df, int dg, int dh, int di, int dj, int dk, int dl, int dm, int dn, int doo, int dp, int dq, int dr, int ds, int dt, int du, int dv, int dw, int dx, int dy, int dz,
|
int da, int db, int dc, int dd, int de, int df, int dg, int dh, int di, int dj, int dk, int dl, int dm, int dn, int doo, int dp, int dq, int dr, int ds, int dt, int du, int dv, int dw, int dx, int dy, int dz,
|
||||||
int ea, int eb, int ec, int ed, int ee, int ef, int eg, int eh, int ei, int ej, int ek, int el, int em, int en, int eo, int ep, int eq, int er, int es, int et, int eu, int ev, int ew, int ex, int ey, int ez,
|
int ea, int eb, int ec, int ed, int ee, int ef, int eg, int eh, int ei, int ej, int ek, int el, int em, int en, int eo, int ep, int eq, int er, int es, int et, int eu, int ev, int ew, int ex, int ey, int ez,
|
||||||
int fa, int fb, int fc, int fd, int fe, int ff, int fg, int fh, int fi, int fj, int fk, int fl, int fm, int fn, int fo, int fp, int fq, int fr, int fs, int ft, int fu, int fv, int fw, int fx, int fy, int fz,
|
int fa, int fb, int fc, int fd, int fe, int ff, int fg, int fh, int fi, int fj, int fk, int fl, int fm, int fn, int fo, int fp, int fq, int fr, int fs, int ft, int fu, int fv, int fw, int fx, int fy, int fz,
|
||||||
int ga, int gb, int gc, int gd, int ge, int gf, int gg, int gh, int gi, int gj, int gk, int gl, int gm, int gn, int go, int gp, int gq, int gr, int gs, int gt, int gu, int gv, int gw, int gx, int gy, int gz,
|
int ga, int gb, int gc, int gd, int ge, int gf, int gg, int gh, int gi, int gj, int gk, int gl, int gm, int gn, int go, int gp, int gq, int gr, int gs, int gt, int gu, int gv, int gw, int gx, int gy, int gz,
|
||||||
int ha, int hb, int hc, int hd, int he, int hf, int hg, int hh, int hi, int hj, int hk, int hl, int hm, int hn, int ho, int hp, int hq, int hr, int hs, int ht, int hu, int hv, int hw, int hx, int hy, int hz,
|
int ha, int hb, int hc, int hd, int he, int hf, int hg, int hh, int hi, int hj, int hk, int hl, int hm, int hn, int ho, int hp, int hq, int hr, int hs, int ht, int hu, int hv, int hw, int hx, int hy, int hz,
|
||||||
int ia, int ib, int ic, int id, int ie, int iff, int ig, int ih, int ii, int ij, int ik, int il, int im, int in, int io, int ip, int iq, int ir, int is, int it, int iu, int iv, int iw, int ix, int iy, int iz,
|
int ia, int ib, int ic, int id, int ie, int iff, int ig, int ih, int ii, int ij, int ik, int il, int im, int in, int io, int ip, int iq, int ir, int is, int it, int iu, int iv, int iw, int ix, int iy, int iz,
|
||||||
int ja, int jb, int jc, int jd, int je, int jf, int jg, int jh, int ji, int jj, int jk, int jl, int jm, int jn, int jo, int jp, int jq, int jr, int js, int jt, int ju, int jv, int jw, int jx, int jy, int jz,
|
int ja, int jb, int jc, int jd, int je, int jf, int jg, int jh, int ji, int jj, int jk, int jl, int jm, int jn, int jo, int jp, int jq, int jr, int js, int jt, int ju, int jv, int jw, int jx, int jy, int jz,
|
||||||
int ka, int kb, int kc, int kd, int ke, int kf, int kg, int kh, int ki, int kj, int kk, int kl, int km, int kn, int ko, int kp, int kq, int kr, int ks, int kt, int ku, int kv, int kw, int kx, int ky, int kz,
|
int ka, int kb, int kc, int kd, int ke, int kf, int kg, int kh, int ki, int kj, int kk, int kl, int km, int kn, int ko, int kp, int kq, int kr, int ks, int kt, int ku, int kv, int kw, int kx, int ky, int kz,
|
||||||
int la, int lb, int lc, int ld, int le, int lf, int lg, int lh, int li, int lj, int lk, int ll, int lm, int ln, int lo, int lp, int lq, int lr, int ls, int lt, int lu, int lv, int lw, int lx, int ly, int lz,
|
int la, int lb, int lc, int ld, int le, int lf, int lg, int lh, int li, int lj, int lk, int ll, int lm, int ln, int lo, int lp, int lq, int lr, int ls, int lt, int lu, int lv, int lw, int lx, int ly, int lz,
|
||||||
int ma, int mb, int mc, int md, int me, int mf, int mg, int mh, int mi, int mj, int mk, int ml, int mm, int mn, int mo, int mp, int mq, int mr, int ms, int mt, int mu, int mv, int mw, int mx, int my, int mz,
|
int ma, int mb, int mc, int md, int me, int mf, int mg, int mh, int mi, int mj, int mk, int ml, int mm, int mn, int mo, int mp, int mq, int mr, int ms, int mt, int mu, int mv, int mw, int mx, int my, int mz,
|
||||||
int na, int nb, int nc, int nd, int ne, int nf, int ng, int nh, int ni, int nj, int nk, int nl, int nm, int nn, int no, int np, int nq, int nr, int ns, int nt, int nu, int nv, int nw, int nx, int ny, int nz,
|
int na, int nb, int nc, int nd, int ne, int nf, int ng, int nh, int ni, int nj, int nk, int nl, int nm, int nn, int no, int np, int nq, int nr, int ns, int nt, int nu, int nv, int nw, int nx, int ny, int nz,
|
||||||
int oa, int ob, int oc, int od, int oe, int of, int og, int oh, int oi, int oj, int ok, int ol, int om, int on, int oo, int op, int oq, int or, int os, int ot, int ou, int ov, int ow, int ox, int oy, int oz,
|
int oa, int ob, int oc, int od, int oe, int of, int og, int oh, int oi, int oj, int ok, int ol, int om, int on, int oo, int op, int oq, int or, int os, int ot, int ou, int ov, int ow, int ox, int oy, int oz,
|
||||||
int pa, int pb, int pc, int pd, int pe, int pf, int pg, int ph, int pi, int pj, int pk, int pl, int pm, int pn, int po, int pp, int pq, int pr, int ps, int pt, int pu, int pv, int pw, int px, int py, int pz,
|
int pa, int pb, int pc, int pd, int pe, int pf, int pg, int ph, int pi, int pj, int pk, int pl, int pm, int pn, int po, int pp, int pq, int pr, int ps, int pt, int pu, int pv, int pw, int px, int py, int pz,
|
||||||
int qa, int qb, int qc, int qd, int qe, int qf, int qg, int qh, int qi, int qj, int qk, int ql, int qm, int qn, int qo, int qp, int qq, int qr, int qs, int qt, int qu, int qv, int qw, int qx, int qy, int qz,
|
int qa, int qb, int qc, int qd, int qe, int qf, int qg, int qh, int qi, int qj, int qk, int ql, int qm, int qn, int qo, int qp, int qq, int qr, int qs, int qt, int qu, int qv, int qw, int qx, int qy, int qz,
|
||||||
int ra, int rb, int rc, int rd, int re, int rf, int rg, int rh, int ri, int rj, int rk, int rl, int rm, int rn, int ro, int rp, int rq, int rr, int rs, int rt, int ru, int rv, int rw, int rx, int ry, int rz,
|
int ra, int rb, int rc, int rd, int re, int rf, int rg, int rh, int ri, int rj, int rk, int rl, int rm, int rn, int ro, int rp, int rq, int rr, int rs, int rt, int ru, int rv, int rw, int rx, int ry, int rz,
|
||||||
int sa, int sb, int sc, int sd, int se, int sf, int sg, int sh, int si, int sj, int sk, int sl, int sm, int sn, int so, int sp, int sq, int sr, int ss, int st, int su, int sv, int sw, int sx, int sy, int sz,
|
int sa, int sb, int sc, int sd, int se, int sf, int sg, int sh, int si, int sj, int sk, int sl, int sm, int sn, int so, int sp, int sq, int sr, int ss, int st, int su, int sv, int sw, int sx, int sy, int sz,
|
||||||
int ta, int tb, int tc, int td, int te, int tf, int tg, int th, int ti, int tj, int tk, int tl, int tm, int tn, int to, int tp, int tq, int tr, int ts, int tt, int tu, int tv, int tw, int tx, int ty, int tz,
|
int ta, int tb, int tc, int td, int te, int tf, int tg, int th, int ti, int tj, int tk, int tl, int tm, int tn, int to, int tp, int tq, int tr, int ts, int tt, int tu, int tv, int tw, int tx, int ty, int tz,
|
||||||
int ua, int ub, int uc, int ud, int ue, int uf, int ug, int uh, int ui, int uj, int uk, int ul, int um, int un, int uo, int up, int uq, int ur, int us, int ut, int uu, int uv, int uw, int ux, int uy, int uz,
|
int ua, int ub, int uc, int ud, int ue, int uf, int ug, int uh, int ui, int uj, int uk, int ul, int um, int un, int uo, int up, int uq, int ur, int us, int ut, int uu, int uv, int uw, int ux, int uy, int uz,
|
||||||
int va, int vb, int vc, int vd, int ve, int vf, int vg, int vh, int vi, int vj, int vk, int vl, int vm, int vn, int vo, int vp, int vq, int vr, int vs, int vt, int vu, int vv, int vw, int vx, int vy, int vz,
|
int va, int vb, int vc, int vd, int ve, int vf, int vg, int vh, int vi, int vj, int vk, int vl, int vm, int vn, int vo, int vp, int vq, int vr, int vs, int vt, int vu, int vv, int vw, int vx, int vy, int vz,
|
||||||
int wa, int wb, int wc, int wd, int we, int wf, int wg, int wh, int wi, int wj, int wk, int wl, int wm, int wn, int wo, int wp, int wq, int wr, int ws, int wt, int wu, int wv, int ww, int wx, int wy, int wz,
|
int wa, int wb, int wc, int wd, int we, int wf, int wg, int wh, int wi, int wj, int wk, int wl, int wm, int wn, int wo, int wp, int wq, int wr, int ws, int wt, int wu, int wv, int ww, int wx, int wy, int wz,
|
||||||
int xa, int xb, int xc, int xd, int xe, int xf, int xg, int xh, int xi, int xj, int xk, int xl, int xm, int xn, int xo, int xp, int xq, int xr, int xs, int xt, int xu, int xv, int xw, int xx, int xy, int xz,
|
int xa, int xb, int xc, int xd, int xe, int xf, int xg, int xh, int xi, int xj, int xk, int xl, int xm, int xn, int xo, int xp, int xq, int xr, int xs, int xt, int xu, int xv, int xw, int xx, int xy, int xz,
|
||||||
int ya, int yb, int yc, int yd, int ye, int yf, int yg, int yh, int yi, int yj, int yk, int yl, int ym, int yn, int yo, int yp, int yq, int yr, int ys, int yt, int yu, int yv, int yw, int yx, int yy, int yz,
|
int ya, int yb, int yc, int yd, int ye, int yf, int yg, int yh, int yi, int yj, int yk, int yl, int ym, int yn, int yo, int yp, int yq, int yr, int ys, int yt, int yu, int yv, int yw, int yx, int yy, int yz,
|
||||||
int za, int zb, int zc, int zd, int ze, int zf, int zg, int zh, int zi, int zj, int zk, int zl, int zm, int zn, int zo, int zp, int zq, int zr, int zs, int zt, int zu, int zv, int zw, int zx, int zy, int zz){
|
int za, int zb, int zc, int zd, int ze, int zf, int zg, int zh, int zi, int zj, int zk, int zl, int zm, int zn, int zo, int zp, int zq, int zr, int zs, int zt, int zu, int zv, int zw, int zx, int zy, int zz){
|
||||||
return
|
return
|
||||||
zi*xy*ve*zl*dk+ui+sd*bx*qr*kk*qk*jt*xj+wl*wg+kb+ii*vj*oa+pb*
|
zi*xy*ve*zl*dk+ui+sd*bx*qr*kk*qk*jt*xj+wl*wg+kb+ii*vj*oa+pb*
|
||||||
ku+ee*fv+ha+bm*jv*ka*mr+gv+qh+ci+az*lj*ie+pz*zg+js*wj*il*fx*
|
ku+ee*fv+ha+bm*jv*ka*mr+gv+qh+ci+az*lj*ie+pz*zg+js*wj*il*fx*
|
||||||
vs+ed+te+ke+sq*hq*da+vb*gp+ab*kx*lc+pn*ae+cs*on+xe+zi+mf+sc*
|
vs+ed+te+ke+sq*hq*da+vb*gp+ab*kx*lc+pn*ae+cs*on+xe+zi+mf+sc*
|
||||||
ak*ko+hx*ax+gc*cm+br*fl+ul+el+nt+tt*eh+gq+up*uj*kz+yj+ah*dl*
|
ak*ko+hx*ax+gc*cm+br*fl+ul+el+nt+tt*eh+gq+up*uj*kz+yj+ah*dl*
|
||||||
xz*il*km*qp*yx+lc+re*qb+nl+on+gq+zs+ca*lh+ra+doo*op+cl*et*ad+
|
xz*il*km*qp*yx+lc+re*qb+nl+on+gq+zs+ca*lh+ra+doo*op+cl*et*ad+
|
||||||
kb+tc+bb*oo+mg+ws*xj+ri*ty*mu+cy+dp*wm*wt+dw+pv+it+iy+it+za*
|
kb+tc+bb*oo+mg+ws*xj+ri*ty*mu+cy+dp*wm*wt+dw+pv+it+iy+it+za*
|
||||||
hw+kx*pc*zs*ht*sv*jy+gk+cq*ym*vz*de*gg+fc*dk*yb*wm+zu+th*bn*
|
hw+kx*pc*zs*ht*sv*jy+gk+cq*ym*vz*de*gg+fc*dk*yb*wm+zu+th*bn*
|
||||||
iy*doo+al+vj*ex*di*jb*ss*bd*kn+yz+kw+tv*ug+iff*wx*fn*ul*tt*fp*
|
iy*doo+al+vj*ex*di*jb*ss*bd*kn+yz+kw+tv*ug+iff*wx*fn*ul*tt*fp*
|
||||||
hn*dv*zv*al*wr+fa*vv+ls+ia*ip*uv+li+zs+em+pa*zf+zb+bt+ad+jp+
|
hn*dv*zv*al*wr+fa*vv+ls+ia*ip*uv+li+zs+em+pa*zf+zb+bt+ad+jp+
|
||||||
ut+tm+et+ct+hc+en*hd*hf*cr*lm+pp*wj*nd*ka*ta+ru*jn+en+gc*jb+
|
ut+tm+et+ct+hc+en*hd*hf*cr*lm+pp*wj*nd*ka*ta+ru*jn+en+gc*jb+
|
||||||
kg*bf+sl+pr+uc+yv+vd*td*xg+cp*rj+qu+vw*ao*oz+zf+qj+kl*st*on*
|
kg*bf+sl+pr+uc+yv+vd*td*xg+cp*rj+qu+vw*ao*oz+zf+qj+kl*st*on*
|
||||||
qq+mv*eu*ay*ih*ta*tm+vh+rz+yn*bp+pr+xt*lw+uo*zl*rv+fz*rz*fz+
|
qq+mv*eu*ay*ih*ta*tm+vh+rz+yn*bp+pr+xt*lw+uo*zl*rv+fz*rz*fz+
|
||||||
mf*sj+xz*yt+qj+ki*gf+ne+gd+vz+oh+hh+ff+ec*xk+hb+pe+mz*yx*aw+
|
mf*sj+xz*yt+qj+ki*gf+ne+gd+vz+oh+hh+ff+ec*xk+hb+pe+mz*yx*aw+
|
||||||
ij+dn+zj*nm+jj*kz*ic*sg+ue*yo+le+fg*kt*br*yx+so*qy+bd+da+iq+
|
ij+dn+zj*nm+jj*kz*ic*sg+ue*yo+le+fg*kt*br*yx+so*qy+bd+da+iq+
|
||||||
go+uu+jj*le+xa+vs*qs+mq+vr+ua+hx*oz*sl*cj*hg+rd*bz+vk*ic+ib+
|
go+uu+jj*le+xa+vs*qs+mq+vr+ua+hx*oz*sl*cj*hg+rd*bz+vk*ic+ib+
|
||||||
fj*au*dm+ve*ks+pl*oi*kd*iu+be*rr+va*hc*tl+wm+rq+ob+pg*hq+pe*
|
fj*au*dm+ve*ks+pl*oi*kd*iu+be*rr+va*hc*tl+wm+rq+ob+pg*hq+pe*
|
||||||
ww*ei*rn+yk+oc*sh*ig*uu+cg*vu*yn+xj*wh+xf+wo+nr+vf*sa*yg+uj+
|
ww*ei*rn+yk+oc*sh*ig*uu+cg*vu*yn+xj*wh+xf+wo+nr+vf*sa*yg+uj+
|
||||||
sb+dt+pn+ui+nc*bv+qa*ze*kn+zt*da+kw*xp+hy*hs+pb+ox*uz*pe+be*
|
sb+dt+pn+ui+nc*bv+qa*ze*kn+zt*da+kw*xp+hy*hs+pb+ox*uz*pe+be*
|
||||||
im+sg+tm*im+gh*ju*zx+fc+pn*ei*we+ae*re+wp*aj+pc*km*pm+hc*bt*
|
im+sg+tm*im+gh*ju*zx+fc+pn*ei*we+ae*re+wp*aj+pc*km*pm+hc*bt*
|
||||||
ap*ik*am+yu+my+wh*ah*tt*fo+rx*te*al+tq+fj+df*ts+jl+lx+ov+in;
|
ap*ik*am+yu+my+wh*ah*tt*fo+rx*te*al+tq+fj+df*ts+jl+lx+ov+in;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
return func(
|
return func(
|
||||||
0,1,1,8,9,5,2,0,6,2,4,7,1,6,9,3,3,5,0,8,9,3,4,5,9,0,
|
0,1,1,8,9,5,2,0,6,2,4,7,1,6,9,3,3,5,0,8,9,3,4,5,9,0,
|
||||||
8,9,5,5,4,1,4,3,5,9,7,6,1,7,5,4,0,7,5,5,6,4,9,6,6,6,
|
8,9,5,5,4,1,4,3,5,9,7,6,1,7,5,4,0,7,5,5,6,4,9,6,6,6,
|
||||||
8,0,4,2,3,3,0,5,4,3,9,5,9,3,3,6,4,3,3,0,5,0,2,5,6,6,
|
8,0,4,2,3,3,0,5,4,3,9,5,9,3,3,6,4,3,3,0,5,0,2,5,6,6,
|
||||||
9,4,0,3,7,2,1,1,9,8,4,8,5,2,5,4,5,0,3,5,0,7,0,7,5,6,
|
9,4,0,3,7,2,1,1,9,8,4,8,5,2,5,4,5,0,3,5,0,7,0,7,5,6,
|
||||||
7,7,8,2,6,8,9,4,6,7,2,9,8,8,0,0,3,4,8,9,0,5,9,8,5,1,
|
7,7,8,2,6,8,9,4,6,7,2,9,8,8,0,0,3,4,8,9,0,5,9,8,5,1,
|
||||||
2,7,3,2,5,4,9,9,6,9,2,5,5,7,8,3,8,9,4,9,0,5,9,8,4,2,
|
2,7,3,2,5,4,9,9,6,9,2,5,5,7,8,3,8,9,4,9,0,5,9,8,4,2,
|
||||||
5,0,7,8,8,4,6,7,9,8,2,4,4,2,9,9,8,1,2,3,7,2,2,1,7,1,
|
5,0,7,8,8,4,6,7,9,8,2,4,4,2,9,9,8,1,2,3,7,2,2,1,7,1,
|
||||||
2,4,0,6,6,0,9,9,0,7,8,9,8,5,1,8,9,2,4,7,3,4,7,9,9,4,
|
2,4,0,6,6,0,9,9,0,7,8,9,8,5,1,8,9,2,4,7,3,4,7,9,9,4,
|
||||||
7,1,9,0,6,0,6,9,8,4,3,6,2,9,7,5,6,9,8,6,5,8,4,0,5,2,
|
7,1,9,0,6,0,6,9,8,4,3,6,2,9,7,5,6,9,8,6,5,8,4,0,5,2,
|
||||||
3,2,4,0,0,9,5,8,9,2,5,2,5,0,9,4,2,0,0,1,5,0,4,9,4,9,
|
3,2,4,0,0,9,5,8,9,2,5,2,5,0,9,4,2,0,0,1,5,0,4,9,4,9,
|
||||||
4,6,0,0,4,2,6,9,3,7,8,5,5,7,1,0,5,3,6,0,3,3,6,2,9,9,
|
4,6,0,0,4,2,6,9,3,7,8,5,5,7,1,0,5,3,6,0,3,3,6,2,9,9,
|
||||||
1,9,6,2,4,1,5,1,5,0,8,5,7,9,4,6,1,3,9,4,2,3,0,8,6,0,
|
1,9,6,2,4,1,5,1,5,0,8,5,7,9,4,6,1,3,9,4,2,3,0,8,6,0,
|
||||||
9,7,3,1,3,7,0,9,2,3,1,2,9,3,8,5,7,3,9,6,7,1,9,6,3,8,
|
9,7,3,1,3,7,0,9,2,3,1,2,9,3,8,5,7,3,9,6,7,1,9,6,3,8,
|
||||||
1,8,8,2,8,7,5,4,2,0,4,0,7,7,8,9,6,6,7,7,1,6,0,5,3,4,
|
1,8,8,2,8,7,5,4,2,0,4,0,7,7,8,9,6,6,7,7,1,6,0,5,3,4,
|
||||||
2,6,3,6,3,4,1,3,6,9,4,3,0,9,0,2,2,0,8,8,4,5,8,2,3,3,
|
2,6,3,6,3,4,1,3,6,9,4,3,0,9,0,2,2,0,8,8,4,5,8,2,3,3,
|
||||||
7,2,5,9,6,7,0,1,8,5,7,8,3,0,2,9,1,5,4,9,4,5,3,7,4,0,
|
7,2,5,9,6,7,0,1,8,5,7,8,3,0,2,9,1,5,4,9,4,5,3,7,4,0,
|
||||||
2,7,1,3,2,7,1,7,0,0,6,7,8,9,0,2,5,4,6,2,9,2,1,0,2,2,
|
2,7,1,3,2,7,1,7,0,0,6,7,8,9,0,2,5,4,6,2,9,2,1,0,2,2,
|
||||||
7,3,8,9,6,3,6,9,0,8,1,2,2,9,5,8,2,5,0,4,7,0,8,2,9,6,
|
7,3,8,9,6,3,6,9,0,8,1,2,2,9,5,8,2,5,0,4,7,0,8,2,9,6,
|
||||||
7,7,5,2,6,6,8,8,9,7,7,4,9,0,8,7,6,8,3,1,6,7,4,6,5,6,
|
7,7,5,2,6,6,8,8,9,7,7,4,9,0,8,7,6,8,3,1,6,7,4,6,5,6,
|
||||||
2,8,8,5,9,0,3,1,9,1,4,9,6,4,7,6,6,8,9,6,6,1,2,5,2,0,
|
2,8,8,5,9,0,3,1,9,1,4,9,6,4,7,6,6,8,9,6,6,1,2,5,2,0,
|
||||||
3,8,2,9,1,3,9,6,2,3,2,9,9,3,8,8,1,9,8,5,1,1,2,7,9,3,
|
3,8,2,9,1,3,9,6,2,3,2,9,9,3,8,8,1,9,8,5,1,1,2,7,9,3,
|
||||||
7,4,3,4,0,7,4,9,1,4,6,4,3,8,3,8,7,6,3,2,1,8,5,2,3,1,
|
7,4,3,4,0,7,4,9,1,4,6,4,3,8,3,8,7,6,3,2,1,8,5,2,3,1,
|
||||||
3,7,6,2,4,0,9,9,7,8,3,7,5,8,8,5,6,7,3,2,9,5,5,1,5,7,
|
3,7,6,2,4,0,9,9,7,8,3,7,5,8,8,5,6,7,3,2,9,5,5,1,5,7,
|
||||||
9,7,9,0,5,4,3,3,0,0,0,3,5,1,6,2,0,4,7,4,9,7,3,4,0,6,
|
9,7,9,0,5,4,3,3,0,0,0,3,5,1,6,2,0,4,7,4,9,7,3,4,0,6,
|
||||||
0,3,1,3,5,7,3,8,3,1,9,6,8,6,7,7,3,2,9,8,1,9,5,8,4,7,
|
0,3,1,3,5,7,3,8,3,1,9,6,8,6,7,7,3,2,9,8,1,9,5,8,4,7,
|
||||||
8,9,9,0,9,2,9,0,0,7,4,3,9,2,2,7,8,7,1,3,5,8,4,4,0,9);
|
8,9,9,0,9,2,9,0,0,7,4,3,9,2,2,7,8,7,1,3,5,8,4,4,0,9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,213 +1,213 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int main() {
|
int main() {
|
||||||
int a, res, n;
|
int a, res, n;
|
||||||
n = getint();
|
n = getint();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < n){
|
while (i < n){
|
||||||
res = 0;
|
res = 0;
|
||||||
a = getint();
|
a = getint();
|
||||||
if (a > 0 && a < 100)
|
if (a > 0 && a < 100)
|
||||||
if (a > 0 && a < 99)
|
if (a > 0 && a < 99)
|
||||||
if (a > 0 && a < 98)
|
if (a > 0 && a < 98)
|
||||||
if (a > 0 && a < 97)
|
if (a > 0 && a < 97)
|
||||||
if (a > 0 && a < 96)
|
if (a > 0 && a < 96)
|
||||||
if (a > 0 && a < 95)
|
if (a > 0 && a < 95)
|
||||||
if (a > 0 && a < 94)
|
if (a > 0 && a < 94)
|
||||||
if (a > 0 && a < 93)
|
if (a > 0 && a < 93)
|
||||||
if (a > 0 && a < 92)
|
if (a > 0 && a < 92)
|
||||||
if (a > 0 && a < 91)
|
if (a > 0 && a < 91)
|
||||||
if (a > 0 && a < 90)
|
if (a > 0 && a < 90)
|
||||||
if (a > 0 && a < 89)
|
if (a > 0 && a < 89)
|
||||||
if (a > 0 && a < 88)
|
if (a > 0 && a < 88)
|
||||||
if (a > 0 && a < 87)
|
if (a > 0 && a < 87)
|
||||||
if (a > 0 && a < 86)
|
if (a > 0 && a < 86)
|
||||||
if (a > 0 && a < 85)
|
if (a > 0 && a < 85)
|
||||||
if (a > 0 && a < 84)
|
if (a > 0 && a < 84)
|
||||||
if (a > 0 && a < 83)
|
if (a > 0 && a < 83)
|
||||||
if (a > 0 && a < 82)
|
if (a > 0 && a < 82)
|
||||||
if (a > 0 && a < 81)
|
if (a > 0 && a < 81)
|
||||||
if (a > 0 && a < 80)
|
if (a > 0 && a < 80)
|
||||||
if (a > 0 && a < 79)
|
if (a > 0 && a < 79)
|
||||||
if (a > 0 && a < 78)
|
if (a > 0 && a < 78)
|
||||||
if (a > 0 && a < 77)
|
if (a > 0 && a < 77)
|
||||||
if (a > 0 && a < 76)
|
if (a > 0 && a < 76)
|
||||||
if (a > 0 && a < 75)
|
if (a > 0 && a < 75)
|
||||||
if (a > 0 && a < 74)
|
if (a > 0 && a < 74)
|
||||||
if (a > 0 && a < 73)
|
if (a > 0 && a < 73)
|
||||||
if (a > 0 && a < 72)
|
if (a > 0 && a < 72)
|
||||||
if (a > 0 && a < 71)
|
if (a > 0 && a < 71)
|
||||||
if (a > 0 && a < 70)
|
if (a > 0 && a < 70)
|
||||||
if (a > 0 && a < 69)
|
if (a > 0 && a < 69)
|
||||||
if (a > 0 && a < 68)
|
if (a > 0 && a < 68)
|
||||||
if (a > 0 && a < 67)
|
if (a > 0 && a < 67)
|
||||||
if (a > 0 && a < 66)
|
if (a > 0 && a < 66)
|
||||||
if (a > 0 && a < 65)
|
if (a > 0 && a < 65)
|
||||||
if (a > 0 && a < 64)
|
if (a > 0 && a < 64)
|
||||||
if (a > 0 && a < 63)
|
if (a > 0 && a < 63)
|
||||||
if (a > 0 && a < 62)
|
if (a > 0 && a < 62)
|
||||||
if (a > 0 && a < 61)
|
if (a > 0 && a < 61)
|
||||||
if (a > 0 && a < 60)
|
if (a > 0 && a < 60)
|
||||||
if (a > 0 && a < 59)
|
if (a > 0 && a < 59)
|
||||||
if (a > 0 && a < 58)
|
if (a > 0 && a < 58)
|
||||||
if (a > 0 && a < 57)
|
if (a > 0 && a < 57)
|
||||||
if (a > 0 && a < 56)
|
if (a > 0 && a < 56)
|
||||||
if (a > 0 && a < 55)
|
if (a > 0 && a < 55)
|
||||||
if (a > 0 && a < 54)
|
if (a > 0 && a < 54)
|
||||||
if (a > 0 && a < 53)
|
if (a > 0 && a < 53)
|
||||||
if (a > 0 && a < 52)
|
if (a > 0 && a < 52)
|
||||||
if (a > 0 && a < 51)
|
if (a > 0 && a < 51)
|
||||||
if (a > 0 && a < 50)
|
if (a > 0 && a < 50)
|
||||||
if (a > 0 && a < 49)
|
if (a > 0 && a < 49)
|
||||||
if (a > 0 && a < 48)
|
if (a > 0 && a < 48)
|
||||||
if (a > 0 && a < 47)
|
if (a > 0 && a < 47)
|
||||||
if (a > 0 && a < 46)
|
if (a > 0 && a < 46)
|
||||||
if (a > 0 && a < 45)
|
if (a > 0 && a < 45)
|
||||||
if (a > 0 && a < 44)
|
if (a > 0 && a < 44)
|
||||||
if (a > 0 && a < 43)
|
if (a > 0 && a < 43)
|
||||||
if (a > 0 && a < 42)
|
if (a > 0 && a < 42)
|
||||||
if (a > 0 && a < 41)
|
if (a > 0 && a < 41)
|
||||||
if (a > 0 && a < 40)
|
if (a > 0 && a < 40)
|
||||||
if (a > 0 && a < 39)
|
if (a > 0 && a < 39)
|
||||||
if (a > 0 && a < 38)
|
if (a > 0 && a < 38)
|
||||||
if (a > 0 && a < 37)
|
if (a > 0 && a < 37)
|
||||||
if (a > 0 && a < 36)
|
if (a > 0 && a < 36)
|
||||||
if (a > 0 && a < 35)
|
if (a > 0 && a < 35)
|
||||||
if (a > 0 && a < 34)
|
if (a > 0 && a < 34)
|
||||||
if (a > 0 && a < 33)
|
if (a > 0 && a < 33)
|
||||||
if (a > 0 && a < 32)
|
if (a > 0 && a < 32)
|
||||||
if (a > 0 && a < 31)
|
if (a > 0 && a < 31)
|
||||||
if (a > 0 && a < 30)
|
if (a > 0 && a < 30)
|
||||||
if (a > 0 && a < 29)
|
if (a > 0 && a < 29)
|
||||||
if (a > 0 && a < 28)
|
if (a > 0 && a < 28)
|
||||||
if (a > 0 && a < 27)
|
if (a > 0 && a < 27)
|
||||||
if (a > 0 && a < 26)
|
if (a > 0 && a < 26)
|
||||||
if (a > 0 && a < 25)
|
if (a > 0 && a < 25)
|
||||||
if (a > 0 && a < 24)
|
if (a > 0 && a < 24)
|
||||||
if (a > 0 && a < 23)
|
if (a > 0 && a < 23)
|
||||||
if (a > 0 && a < 22)
|
if (a > 0 && a < 22)
|
||||||
if (a > 0 && a < 21)
|
if (a > 0 && a < 21)
|
||||||
if (a > 0 && a < 20)
|
if (a > 0 && a < 20)
|
||||||
if (a > 0 && a < 19)
|
if (a > 0 && a < 19)
|
||||||
if (a > 0 && a < 18)
|
if (a > 0 && a < 18)
|
||||||
if (a > 0 && a < 17)
|
if (a > 0 && a < 17)
|
||||||
if (a > 0 && a < 16)
|
if (a > 0 && a < 16)
|
||||||
if (a > 0 && a < 15)
|
if (a > 0 && a < 15)
|
||||||
if (a > 0 && a < 14)
|
if (a > 0 && a < 14)
|
||||||
if (a > 0 && a < 13)
|
if (a > 0 && a < 13)
|
||||||
if (a > 0 && a < 12)
|
if (a > 0 && a < 12)
|
||||||
if (a > 0 && a < 11)
|
if (a > 0 && a < 11)
|
||||||
if (a > 0 && a < 10)
|
if (a > 0 && a < 10)
|
||||||
if (a > 0 && a < 9)
|
if (a > 0 && a < 9)
|
||||||
if (a > 0 && a < 8)
|
if (a > 0 && a < 8)
|
||||||
if (a > 0 && a < 7)
|
if (a > 0 && a < 7)
|
||||||
if (a > 0 && a < 6)
|
if (a > 0 && a < 6)
|
||||||
if (a > 0 && a < 5)
|
if (a > 0 && a < 5)
|
||||||
if (a > 0 && a < 4)
|
if (a > 0 && a < 4)
|
||||||
if (a > 0 && a < 3)
|
if (a > 0 && a < 3)
|
||||||
if (a > 0 && a < 2)
|
if (a > 0 && a < 2)
|
||||||
res = res + 1;
|
res = res + 1;
|
||||||
else res = res + 2;
|
else res = res + 2;
|
||||||
else res = res + 3;
|
else res = res + 3;
|
||||||
else res = res + 4;
|
else res = res + 4;
|
||||||
else res = res + 5;
|
else res = res + 5;
|
||||||
else res = res + 6;
|
else res = res + 6;
|
||||||
else res = res + 7;
|
else res = res + 7;
|
||||||
else res = res + 8;
|
else res = res + 8;
|
||||||
else res = res + 9;
|
else res = res + 9;
|
||||||
else res = res + 10;
|
else res = res + 10;
|
||||||
else res = res + 11;
|
else res = res + 11;
|
||||||
else res = res + 12;
|
else res = res + 12;
|
||||||
else res = res + 13;
|
else res = res + 13;
|
||||||
else res = res + 14;
|
else res = res + 14;
|
||||||
else res = res + 15;
|
else res = res + 15;
|
||||||
else res = res + 16;
|
else res = res + 16;
|
||||||
else res = res + 17;
|
else res = res + 17;
|
||||||
else res = res + 18;
|
else res = res + 18;
|
||||||
else res = res + 19;
|
else res = res + 19;
|
||||||
else res = res + 20;
|
else res = res + 20;
|
||||||
else res = res + 21;
|
else res = res + 21;
|
||||||
else res = res + 22;
|
else res = res + 22;
|
||||||
else res = res + 23;
|
else res = res + 23;
|
||||||
else res = res + 24;
|
else res = res + 24;
|
||||||
else res = res + 25;
|
else res = res + 25;
|
||||||
else res = res + 26;
|
else res = res + 26;
|
||||||
else res = res + 27;
|
else res = res + 27;
|
||||||
else res = res + 28;
|
else res = res + 28;
|
||||||
else res = res + 29;
|
else res = res + 29;
|
||||||
else res = res + 30;
|
else res = res + 30;
|
||||||
else res = res + 31;
|
else res = res + 31;
|
||||||
else res = res + 32;
|
else res = res + 32;
|
||||||
else res = res + 33;
|
else res = res + 33;
|
||||||
else res = res + 34;
|
else res = res + 34;
|
||||||
else res = res + 35;
|
else res = res + 35;
|
||||||
else res = res + 36;
|
else res = res + 36;
|
||||||
else res = res + 37;
|
else res = res + 37;
|
||||||
else res = res + 38;
|
else res = res + 38;
|
||||||
else res = res + 39;
|
else res = res + 39;
|
||||||
else res = res + 40;
|
else res = res + 40;
|
||||||
else res = res + 41;
|
else res = res + 41;
|
||||||
else res = res + 42;
|
else res = res + 42;
|
||||||
else res = res + 43;
|
else res = res + 43;
|
||||||
else res = res + 44;
|
else res = res + 44;
|
||||||
else res = res + 45;
|
else res = res + 45;
|
||||||
else res = res + 46;
|
else res = res + 46;
|
||||||
else res = res + 47;
|
else res = res + 47;
|
||||||
else res = res + 48;
|
else res = res + 48;
|
||||||
else res = res + 49;
|
else res = res + 49;
|
||||||
else res = res + 50;
|
else res = res + 50;
|
||||||
else res = res + 51;
|
else res = res + 51;
|
||||||
else res = res + 52;
|
else res = res + 52;
|
||||||
else res = res + 53;
|
else res = res + 53;
|
||||||
else res = res + 54;
|
else res = res + 54;
|
||||||
else res = res + 55;
|
else res = res + 55;
|
||||||
else res = res + 56;
|
else res = res + 56;
|
||||||
else res = res + 57;
|
else res = res + 57;
|
||||||
else res = res + 58;
|
else res = res + 58;
|
||||||
else res = res + 59;
|
else res = res + 59;
|
||||||
else res = res + 60;
|
else res = res + 60;
|
||||||
else res = res + 61;
|
else res = res + 61;
|
||||||
else res = res + 62;
|
else res = res + 62;
|
||||||
else res = res + 63;
|
else res = res + 63;
|
||||||
else res = res + 64;
|
else res = res + 64;
|
||||||
else res = res + 65;
|
else res = res + 65;
|
||||||
else res = res + 66;
|
else res = res + 66;
|
||||||
else res = res + 67;
|
else res = res + 67;
|
||||||
else res = res + 68;
|
else res = res + 68;
|
||||||
else res = res + 69;
|
else res = res + 69;
|
||||||
else res = res + 70;
|
else res = res + 70;
|
||||||
else res = res + 71;
|
else res = res + 71;
|
||||||
else res = res + 72;
|
else res = res + 72;
|
||||||
else res = res + 73;
|
else res = res + 73;
|
||||||
else res = res + 74;
|
else res = res + 74;
|
||||||
else res = res + 75;
|
else res = res + 75;
|
||||||
else res = res + 76;
|
else res = res + 76;
|
||||||
else res = res + 77;
|
else res = res + 77;
|
||||||
else res = res + 78;
|
else res = res + 78;
|
||||||
else res = res + 79;
|
else res = res + 79;
|
||||||
else res = res + 80;
|
else res = res + 80;
|
||||||
else res = res + 81;
|
else res = res + 81;
|
||||||
else res = res + 82;
|
else res = res + 82;
|
||||||
else res = res + 83;
|
else res = res + 83;
|
||||||
else res = res + 84;
|
else res = res + 84;
|
||||||
else res = res + 85;
|
else res = res + 85;
|
||||||
else res = res + 86;
|
else res = res + 86;
|
||||||
else res = res + 87;
|
else res = res + 87;
|
||||||
else res = res + 88;
|
else res = res + 88;
|
||||||
else res = res + 89;
|
else res = res + 89;
|
||||||
else res = res + 90;
|
else res = res + 90;
|
||||||
else res = res + 91;
|
else res = res + 91;
|
||||||
else res = res + 92;
|
else res = res + 92;
|
||||||
else res = res + 93;
|
else res = res + 93;
|
||||||
else res = res + 94;
|
else res = res + 94;
|
||||||
else res = res + 95;
|
else res = res + 95;
|
||||||
else res = res + 96;
|
else res = res + 96;
|
||||||
else res = res + 97;
|
else res = res + 97;
|
||||||
else res = res + 98;
|
else res = res + 98;
|
||||||
else res = res + 99;
|
else res = res + 99;
|
||||||
else res = res + 100;
|
else res = res + 100;
|
||||||
putint(res);
|
putint(res);
|
||||||
putch(10);
|
putch(10);
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,67 +1,67 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
int main() {
|
int main() {
|
||||||
int a=0;
|
int a=0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < 3) {
|
while (i < 3) {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
while (j < 4) {
|
while (j < 4) {
|
||||||
int k = 0;
|
int k = 0;
|
||||||
while (k < 5) {
|
while (k < 5) {
|
||||||
int ii = 0;
|
int ii = 0;
|
||||||
while (ii < 3) {
|
while (ii < 3) {
|
||||||
int jj = 0;
|
int jj = 0;
|
||||||
while (jj < 5) {
|
while (jj < 5) {
|
||||||
int kk = 0;
|
int kk = 0;
|
||||||
while (kk < 4) {
|
while (kk < 4) {
|
||||||
int iii = 0;
|
int iii = 0;
|
||||||
while (iii < 6) {
|
while (iii < 6) {
|
||||||
int jjj = 0;
|
int jjj = 0;
|
||||||
while (jjj < 5) {
|
while (jjj < 5) {
|
||||||
int kkk = 0;
|
int kkk = 0;
|
||||||
while (kkk < 5) {
|
while (kkk < 5) {
|
||||||
int iiii = 0;
|
int iiii = 0;
|
||||||
while (iiii < 3) {
|
while (iiii < 3) {
|
||||||
int jjjj = 0;
|
int jjjj = 0;
|
||||||
while (jjjj < 6) {
|
while (jjjj < 6) {
|
||||||
int kkkk = 0;
|
int kkkk = 0;
|
||||||
while (kkkk < 7) {
|
while (kkkk < 7) {
|
||||||
int iiiii = 0;
|
int iiiii = 0;
|
||||||
while (iiiii < 5) {
|
while (iiiii < 5) {
|
||||||
int jjjjj = 0;
|
int jjjjj = 0;
|
||||||
while (jjjjj < 3) {
|
while (jjjjj < 3) {
|
||||||
int kkkkk = 0;
|
int kkkkk = 0;
|
||||||
while (kkkkk < 6) {
|
while (kkkkk < 6) {
|
||||||
a = (a + 3) % 999;
|
a = (a + 3) % 999;
|
||||||
kkkkk = kkkkk + 3;
|
kkkkk = kkkkk + 3;
|
||||||
}
|
}
|
||||||
jjjjj = jjjjj + 1;
|
jjjjj = jjjjj + 1;
|
||||||
}
|
}
|
||||||
iiiii = iiiii + 2;
|
iiiii = iiiii + 2;
|
||||||
}
|
}
|
||||||
kkkk = kkkk + 2;
|
kkkk = kkkk + 2;
|
||||||
}
|
}
|
||||||
jjjj = jjjj + 2;
|
jjjj = jjjj + 2;
|
||||||
}
|
}
|
||||||
iiii = iiii + 1;
|
iiii = iiii + 1;
|
||||||
}
|
}
|
||||||
kkk = kkk + 1;
|
kkk = kkk + 1;
|
||||||
}
|
}
|
||||||
jjj = jjj + 1;
|
jjj = jjj + 1;
|
||||||
}
|
}
|
||||||
iii = iii + 1;
|
iii = iii + 1;
|
||||||
}
|
}
|
||||||
kk = kk + 1;
|
kk = kk + 1;
|
||||||
}
|
}
|
||||||
jj = jj + 1;
|
jj = jj + 1;
|
||||||
}
|
}
|
||||||
ii = ii + 1;
|
ii = ii + 1;
|
||||||
}
|
}
|
||||||
k = k + 1;
|
k = k + 1;
|
||||||
}
|
}
|
||||||
j = j + 1;
|
j = j + 1;
|
||||||
}
|
}
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int set(int a[], int pos, int d){
|
int set(int a[], int pos, int d){
|
||||||
#define bitcount 30
|
#define bitcount 30
|
||||||
int x[bitcount + 1] = {};
|
int x[bitcount + 1] = {};
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int set(int a[], int pos, int d){
|
int set(int a[], int pos, int d){
|
||||||
#define bitcount 30
|
#define bitcount 30
|
||||||
int x[bitcount + 1] = {};
|
int x[bitcount + 1] = {};
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int set(int a[], int pos, int d){
|
int set(int a[], int pos, int d){
|
||||||
#define bitcount 30
|
#define bitcount 30
|
||||||
int x[bitcount + 1] = {};
|
int x[bitcount + 1] = {};
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define N 1024
|
#define N 1024
|
||||||
|
|
||||||
void mm(int n, int A[][N], int B[][N], int C[][N]){
|
void mm(int n, int A[][N], int B[][N], int C[][N]){
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define N 1024
|
#define N 1024
|
||||||
|
|
||||||
void mm(int n, int A[][N], int B[][N], int C[][N]){
|
void mm(int n, int A[][N], int B[][N], int C[][N]){
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define N 1024
|
#define N 1024
|
||||||
|
|
||||||
void mm(int n, int A[][N], int B[][N], int C[][N]){
|
void mm(int n, int A[][N], int B[][N], int C[][N]){
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
#define N 2010
|
#define N 2010
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
#define N 2010
|
#define N 2010
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
#define N 2010
|
#define N 2010
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define base 16
|
#define base 16
|
||||||
|
|
||||||
int getMaxNum(int n, int arr[]){
|
int getMaxNum(int n, int arr[]){
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define base 16
|
#define base 16
|
||||||
|
|
||||||
int getMaxNum(int n, int arr[]){
|
int getMaxNum(int n, int arr[]){
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define base 16
|
#define base 16
|
||||||
|
|
||||||
int getMaxNum(int n, int arr[]){
|
int getMaxNum(int n, int arr[]){
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
void spmv(int n,int xptr[], int yidx[], int vals[], int b[], int x[]){
|
void spmv(int n,int xptr[], int yidx[], int vals[], int b[], int x[]){
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
void spmv(int n,int xptr[], int yidx[], int vals[], int b[], int x[]){
|
void spmv(int n,int xptr[], int yidx[], int vals[], int b[], int x[]){
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
void spmv(int n,int xptr[], int yidx[], int vals[], int b[], int x[]){
|
void spmv(int n,int xptr[], int yidx[], int vals[], int b[], int x[]){
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
// Brainfuck Interpreter
|
// Brainfuck Interpreter
|
||||||
// Reads program from stdin, interprets and outputs to stdout.
|
// Reads program from stdin, interprets and outputs to stdout.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
// Brainfuck Interpreter
|
// Brainfuck Interpreter
|
||||||
// Reads program from stdin, interprets and outputs to stdout.
|
// Reads program from stdin, interprets and outputs to stdout.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
// Brainfuck Interpreter
|
// Brainfuck Interpreter
|
||||||
// Reads program from stdin, interprets and outputs to stdout.
|
// Reads program from stdin, interprets and outputs to stdout.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define max 1073741824
|
#define max 1073741824
|
||||||
int checkrange(int num){
|
int checkrange(int num){
|
||||||
while (num > max) num = num - max;
|
while (num > max) num = num - max;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define max 1073741824
|
#define max 1073741824
|
||||||
int checkrange(int num){
|
int checkrange(int num){
|
||||||
while (num > max) num = num - max;
|
while (num > max) num = num - max;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define max 1073741824
|
#define max 1073741824
|
||||||
int checkrange(int num){
|
int checkrange(int num){
|
||||||
while (num > max) num = num - max;
|
while (num > max) num = num - max;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
|
|
||||||
|
|
||||||
int state = 19260817;
|
int state = 19260817;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
|
|
||||||
|
|
||||||
int state = 19260817;
|
int state = 19260817;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
|
|
||||||
|
|
||||||
int state = 19260817;
|
int state = 19260817;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
//gcc dead-code-elimination.c sylib.c -include sylib.h -Wall -Wno-unused-result -Wno-unused-variable -o binary-dead-code-elimination && time ./binary-dead-code-elimination < dead-code-elimination.in
|
//gcc dead-code-elimination.c sylib.c -include sylib.h -Wall -Wno-unused-result -Wno-unused-variable -o binary-dead-code-elimination && time ./binary-dead-code-elimination < dead-code-elimination.in
|
||||||
int loopCount = 0;
|
int loopCount = 0;
|
||||||
int global = 0;
|
int global = 0;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
//gcc dead-code-elimination.c sylib.c -include sylib.h -Wall -Wno-unused-result -Wno-unused-variable -o binary-dead-code-elimination && time ./binary-dead-code-elimination < dead-code-elimination.in
|
//gcc dead-code-elimination.c sylib.c -include sylib.h -Wall -Wno-unused-result -Wno-unused-variable -o binary-dead-code-elimination && time ./binary-dead-code-elimination < dead-code-elimination.in
|
||||||
int loopCount = 0;
|
int loopCount = 0;
|
||||||
int global = 0;
|
int global = 0;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
//gcc dead-code-elimination.c sylib.c -include sylib.h -Wall -Wno-unused-result -Wno-unused-variable -o binary-dead-code-elimination && time ./binary-dead-code-elimination < dead-code-elimination.in
|
//gcc dead-code-elimination.c sylib.c -include sylib.h -Wall -Wno-unused-result -Wno-unused-variable -o binary-dead-code-elimination && time ./binary-dead-code-elimination < dead-code-elimination.in
|
||||||
int loopCount = 0;
|
int loopCount = 0;
|
||||||
int global = 0;
|
int global = 0;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define mod 998244353
|
#define mod 998244353
|
||||||
int d;
|
int d;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define mod 998244353
|
#define mod 998244353
|
||||||
int d;
|
int d;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define mod 998244353
|
#define mod 998244353
|
||||||
int d;
|
int d;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define maxlen 2097152
|
#define maxlen 2097152
|
||||||
int temp[maxlen], w[maxlen], dst[maxlen], c[maxlen];
|
int temp[maxlen], w[maxlen], dst[maxlen], c[maxlen];
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define maxlen 2097152
|
#define maxlen 2097152
|
||||||
int temp[maxlen], w[maxlen], dst[maxlen], c[maxlen];
|
int temp[maxlen], w[maxlen], dst[maxlen], c[maxlen];
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define maxlen 2097152
|
#define maxlen 2097152
|
||||||
int temp[maxlen], w[maxlen], dst[maxlen], c[maxlen];
|
int temp[maxlen], w[maxlen], dst[maxlen], c[maxlen];
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int sheet1[500][500] = {};
|
int sheet1[500][500] = {};
|
||||||
int sheet2[500][500] = {};
|
int sheet2[500][500] = {};
|
||||||
int active = 1;
|
int active = 1;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int sheet1[500][500] = {};
|
int sheet1[500][500] = {};
|
||||||
int sheet2[500][500] = {};
|
int sheet2[500][500] = {};
|
||||||
int active = 1;
|
int active = 1;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int sheet1[500][500] = {};
|
int sheet1[500][500] = {};
|
||||||
int sheet2[500][500] = {};
|
int sheet2[500][500] = {};
|
||||||
int active = 1;
|
int active = 1;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
//gcc hoist.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-hoist && time ./binary-hoist < hoist.in
|
//gcc hoist.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-hoist && time ./binary-hoist < hoist.in
|
||||||
int loopCount = 0;
|
int loopCount = 0;
|
||||||
int func(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15)
|
int func(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
//gcc hoist.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-hoist && time ./binary-hoist < hoist.in
|
//gcc hoist.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-hoist && time ./binary-hoist < hoist.in
|
||||||
int loopCount = 0;
|
int loopCount = 0;
|
||||||
int func(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15)
|
int func(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
//gcc hoist.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-hoist && time ./binary-hoist < hoist.in
|
//gcc hoist.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-hoist && time ./binary-hoist < hoist.in
|
||||||
int loopCount = 0;
|
int loopCount = 0;
|
||||||
int func(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15)
|
int func(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
//gcc instruction-combining.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-instruction-combining && time ./binary-instruction-combining < instruction-combining.in
|
//gcc instruction-combining.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-instruction-combining && time ./binary-instruction-combining < instruction-combining.in
|
||||||
int loopCount = 0;
|
int loopCount = 0;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
//gcc instruction-combining.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-instruction-combining && time ./binary-instruction-combining < instruction-combining.in
|
//gcc instruction-combining.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-instruction-combining && time ./binary-instruction-combining < instruction-combining.in
|
||||||
int loopCount = 0;
|
int loopCount = 0;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
//gcc instruction-combining.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-instruction-combining && time ./binary-instruction-combining < instruction-combining.in
|
//gcc instruction-combining.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-instruction-combining && time ./binary-instruction-combining < instruction-combining.in
|
||||||
int loopCount = 0;
|
int loopCount = 0;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
//gcc integer-divide-optimization.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-integer-divide-optimization && time ./binary-integer-divide-optimization < integer-divide-optimization.in
|
//gcc integer-divide-optimization.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-integer-divide-optimization && time ./binary-integer-divide-optimization < integer-divide-optimization.in
|
||||||
int loopCount = 0;
|
int loopCount = 0;
|
||||||
int multi = 2;
|
int multi = 2;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
//gcc integer-divide-optimization.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-integer-divide-optimization && time ./binary-integer-divide-optimization < integer-divide-optimization.in
|
//gcc integer-divide-optimization.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-integer-divide-optimization && time ./binary-integer-divide-optimization < integer-divide-optimization.in
|
||||||
int loopCount = 0;
|
int loopCount = 0;
|
||||||
int multi = 2;
|
int multi = 2;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
//gcc integer-divide-optimization.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-integer-divide-optimization && time ./binary-integer-divide-optimization < integer-divide-optimization.in
|
//gcc integer-divide-optimization.c sylib.c -include sylib.h -Wall -Wno-unused-result -o binary-integer-divide-optimization && time ./binary-integer-divide-optimization < integer-divide-optimization.in
|
||||||
int loopCount = 0;
|
int loopCount = 0;
|
||||||
int multi = 2;
|
int multi = 2;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int n;
|
int n;
|
||||||
int meanless_calculation(int x, int y){
|
int meanless_calculation(int x, int y){
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int n;
|
int n;
|
||||||
int meanless_calculation(int x, int y){
|
int meanless_calculation(int x, int y){
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int n;
|
int n;
|
||||||
int meanless_calculation(int x, int y){
|
int meanless_calculation(int x, int y){
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int hashmod;
|
int hashmod;
|
||||||
|
|
||||||
#define maxn 10000000
|
#define maxn 10000000
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int hashmod;
|
int hashmod;
|
||||||
|
|
||||||
#define maxn 10000000
|
#define maxn 10000000
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int hashmod;
|
int hashmod;
|
||||||
|
|
||||||
#define maxn 10000000
|
#define maxn 10000000
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int x[600][600][600];
|
int x[600][600][600];
|
||||||
int y[600][600][600];
|
int y[600][600][600];
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int x[600][600][600];
|
int x[600][600][600];
|
||||||
int y[600][600][600];
|
int y[600][600][600];
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int x[600][600][600];
|
int x[600][600][600];
|
||||||
int y[600][600][600];
|
int y[600][600][600];
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define width 512
|
#define width 512
|
||||||
#define height 1024
|
#define height 1024
|
||||||
int image_in[width * height];
|
int image_in[width * height];
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
#define width 1024
|
#define width 1024
|
||||||
#define height 1024
|
#define height 1024
|
||||||
int image_in[width * height];
|
int image_in[width * height];
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int matrix[20000000];
|
int matrix[20000000];
|
||||||
int a[100000];
|
int a[100000];
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int matrix[20000000];
|
int matrix[20000000];
|
||||||
int a[100000];
|
int a[100000];
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "sylib.h"
|
#include "sylib.h"
|
||||||
#include "sylib.h"
|
|
||||||
int matrix[20000000];
|
int matrix[20000000];
|
||||||
int a[100000];
|
int a[100000];
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
# Walk through all directories and subdirectories from the current directory
|
||||||
|
for dirpath, dirnames, filenames in os.walk('.'):
|
||||||
|
# For each file in the directories
|
||||||
|
for filename in filenames:
|
||||||
|
# If the file is a .sy file
|
||||||
|
if filename.endswith('.sy'):
|
||||||
|
filepath = os.path.join(dirpath, filename)
|
||||||
|
with open(filepath, 'r+') as file:
|
||||||
|
content = file.read()
|
||||||
|
# Add '#include "sylib.h"' at the beginning of the file
|
||||||
|
file.seek(0, 0)
|
||||||
|
file.write('#include "sylib.h"\n' + content)
|
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Specify the directory
|
|
||||||
dir="."
|
|
||||||
|
|
||||||
# Loop over all .sy files in the directory
|
|
||||||
find "$dir"/*/sy -type f -name "*.sy" -print0 | while IFS= read -r -d '' file; do
|
|
||||||
# Use sed to add #include "sylib.h" at the beginning of each file
|
|
||||||
sed -i '1i#include "sylib.h"' "$file"
|
|
||||||
done
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
# Walk through all directories and subdirectories from the current directory
|
||||||
|
for dirpath, dirnames, filenames in os.walk('.'):
|
||||||
|
# For each file in the directories
|
||||||
|
for filename in filenames:
|
||||||
|
# If the file is a .sy file
|
||||||
|
if filename.endswith('.sy'):
|
||||||
|
filepath = os.path.join(dirpath, filename)
|
||||||
|
with open(filepath, 'r') as file:
|
||||||
|
lines = file.readlines()
|
||||||
|
# Remove lines containing '#include "sylib.h"'
|
||||||
|
lines = [line for line in lines if '#include "sylib.h"' not in line]
|
||||||
|
with open(filepath, 'w') as file:
|
||||||
|
file.writelines(lines)
|
|
@ -1,24 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# 定义文件夹路径数组
|
|
||||||
folder_path_vec=(
|
|
||||||
final_performance_c/sy
|
|
||||||
performace_c/sy
|
|
||||||
hidden_functional_c/sy
|
|
||||||
functional_c/sy
|
|
||||||
final_performance_c/sy
|
|
||||||
)
|
|
||||||
|
|
||||||
# 迭代文件夹路径数组
|
|
||||||
for folder_path in "${folder_path_vec[@]}"; do
|
|
||||||
# 迭代文件夹中的所有.sy文件
|
|
||||||
for file in "$folder_path"/*.sy; do
|
|
||||||
# 检查文件是否存在
|
|
||||||
if [ -f "$file" ]; then
|
|
||||||
# 删除文件中包含#include "sylib.h"的行,并将结果保存到临时文件中
|
|
||||||
grep -v '#include "sylib.h"' "$file" >"$file.tmp" && mv "$file.tmp" "$file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "已删除所有.sy文件中的#include \"sylib.h\"行"
|
|
Loading…
Reference in New Issue