This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main(int argc, char *argv[]) { | |
int x=0, y=0, count=0, users=0; | |
int max=0; | |
scanf("%d%d", &count, &users); | |
--count; | |
int *stages = malloc(sizeof(*stages) * count); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)imageView:(id)view didReceivedBundle:(NSBundle *)bundle | |
{ | |
NSAlert *alert = [NSAlert alertWithMessageText: @"" | |
defaultButton: @"Okay" | |
alternateButton: nil | |
otherButton: nil | |
informativeTextWithFormat: @""]; | |
if (!bundle) { | |
/* The case should never be occurred */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// textView - ваш NSTextView | |
// NSString *search_query - {глобальная переменная/член класса} | |
// строка, которую вам нужно найти | |
// NSRange result_range - {глобальная переменная/член класса} | |
// последние результаты поиска | |
// BOOL backwards_search - {глобальная переменная/член класса} | |
// поиск в обратном направлении? | |
// | |
/* "Главный" метод */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSMutableARRAY *main_array = [[NSMutableArray alloc]init]; | |
TBXML * tbxml = [[TBXML tbxmlWithURL: | |
[NSURL URLWithString: @"http://www.w3schools.com/xml/plant_catalog.xml"]] retain]; | |
TBXMLElement *root = tbxml.rootXMLElement; | |
if (root) { | |
TBXMLElement *current_element = [TBXML childElementNamed: @"PLANT" | |
parentElement: root]; | |
while (current_element != nil) { | |
TBXMLElement *entry = [TBXML childElementNamed: @"BOTANICAL" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input = $stdin.readline.split | |
n, m = input[0].to_i, input[1].to_i | |
$cmpts = Array.new(n){0} | |
def QprintEnergy(var) | |
var = $cmpts.inject(0){|sum, n| sum += n } | |
print var.to_s + "\n" | |
end | |
def Qparse_string() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
substr = $stdin.readline | |
main = $stdin.readline | |
mlen = main.length-1 | |
slen = substr.length-1 | |
glob_count = 0 | |
results = Array.new() | |
for i in 0...(mlen - slen+1) do | |
tmp_count = 0 | |
field = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Manager = Struct.new(:time, :cnt) | |
n = gets().to_i | |
times = $stdin.readline.split.each{|z| z = z.to_i}.sort!{|x,y| y <=> x} | |
managers = Array.new(3){|x| Manager.new(0,0)} | |
while (times.count > 0) do | |
managers.sort!{|x,y| x.time <=> y.time}[0].time += times.shift.to_i | |
managers[0].cnt += 1 | |
end | |
managers.each{|x| print x.cnt.to_s + " "} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var i,k: integer; | |
a: array [1..10] of string; | |
s: string; | |
begin | |
readln(s); | |
k:=1; | |
for i:= 1 to length(s) do | |
if (s[i]<> ' ') then a[k]:= a[k] + s[i] | |
else if (a[k] <> '') then inc(k); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Var a:array[1..240] of string; | |
s:string; j,i:integer; | |
begin | |
readln(s);s:=s+' '; | |
j:=1; | |
for i:=1 to length(s)-1 do | |
if s[i]<>' ' then | |
a[j]:=a[j]+s[i] | |
else if s[i+1]<> ' ' then | |
j:=j+1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <malloc.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int is_digit(char c) | |
{ | |
return (c >= '0' && c <= '9'); | |
} |
NewerOlder