This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <conio.h> | |
#include <stdlib.h> | |
main() | |
{ | |
FILE *in[5], *out[5]; | |
char files [10][15] ={"t1.txt", "t2.txt", "t3.txt", "t4.txt","t5.txt", "t6.txt", "t7.txt", "t8.txt","t9.txt", "t10.txt"}; | |
int number [10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; | |
int i, k, ks, n[5], flag[5], flags, a, minn;//флагс признак окончания файлов, если равен нулю значит все файлы прочитались |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Gee; | |
void main () { | |
var map = new HashMap<int, int> (); | |
int []arr = {2, 1, 2, 5, 5, 6, 5, 7, 8, 7}; | |
int j=0; | |
for (int i=0;i<arr.length;i++) { | |
if (!map.has_key(arr[i])) { | |
map[arr[i]]=j; j++; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(string[] args) { | |
int n=7; | |
int m=12; | |
int k=3; | |
int result=0; | |
result=(n/k)+(m/k); | |
if(n%k!=0)result++;if(m%k!=0)result++; | |
stdout.printf(@"n=$n, m=$m\nn Ост=$(n%k), m Ост=$(m%k)\n$result"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(string[] args){ | |
int a = 1, b = 2, c = 4; | |
int max = a; | |
if (a < b) max = b; if (max < c) max = c; //находим большее | |
int r=(a+b+c)/2;//должно быть у каждого | |
if (a + b == c || a + c == b || b + c == a) | |
stdout.printf("Пилить не надо, разбегаемся.\n"); | |
else if ((a==b)||(b==c)||(a==c)) {//случай с одинаковыми | |
if(a==b && c>a) stdout.printf(@"3-тий кусок, 1-ая доля = $(max/2), 2-я доля = $(max/2)"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(string[] args) { | |
string sass = "sas, sos, sus, sыs, ses, sюs"; | |
int a=42,b=5; | |
string str="%d — ответ на главный вопрос жизни, вселенной и всего такого".printf(a); | |
// bool b = bool.parse("false"); // => false | |
// int i = int.parse("-52"); // => -52 | |
// double d = double.parse("6.67428E-11"); // => 6.67428E-11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Gee; | |
void main(string[] args) { | |
var s="asds";var result = false; | |
unichar c; | |
var records = new HashMap<unichar, bool> (); | |
for (int i = 0; s.get_next_char (ref i, out c);) { | |
stdout.printf (@"$i, $c\t"); | |
if (records[c]){ | |
result=true;stdout.printf("буква найдена: true\n");break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Gee; | |
void fill_col(ref int[,] arr,int a){ | |
for (int i = 0; i < arr.length[0]; i++) { | |
arr[i,a]=0; | |
} | |
} | |
void fill_row(ref int[,] arr,int a){ | |
for (int i = 0; i < arr.length[1]; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(string[] args) { | |
int[,] d = {{0, 1}, | |
{1, 0}}; | |
int c=0; | |
foreach (var a in d) | |
if(a==1) c++; | |
print(@"Roads: $(c/2)"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string exponentiation(string str, int n){ | |
string result=""; | |
for (int i=0;i<n;i++) result+=str; | |
return result; | |
} | |
string take_root(string str, int n){ | |
int temp = (str+str)[0:-1].index_of(str,1); | |
if(temp != -1 && (str.char_count()>=str[0:temp].char_count()*n)){ | |
return exponentiation (str[0:temp],str.char_count()/temp /n); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int func (int k, int n){ | |
return k<<n; | |
} | |
void main(string[] args) { | |
print(@"$(func(3,4))"); | |
} |
OlderNewer