Search found 5 matches

by chessmaster
Thu Oct 03, 2002 9:45 am
Forum: Volume 3 (300-399)
Topic: 305 - Joseph
Replies: 41
Views: 3674

[c] # include <stdio.h> long coba(long n) { long a=n,b,n2=2*n,nn; while (1) { a++; b=a; b=b%n2; nn=n2-1; if (b==0) b=n2; while (nn>n && b>=n+1 ) { b--; b+=a; b%=nn; if (b==0) b=nn; nn--; }/*while*/ if (nn<=n && (b>n || b==0)) return a; } // return 0; } void main() { long a,b=0; long tabel[200]; whil...
by chessmaster
Tue Oct 01, 2002 11:27 am
Forum: Volume 6 (600-699)
Topic: 612 - DNA Sorting
Replies: 122
Views: 15591

612-DNA SORTING WA

[pascal] type tt=record d:string; pos:integer; end; var data:array[1..200] of tt; d3:array[1..200]of INTEGER; temp:tt; var a,b,n,jb:integer; function hitung(s:string):integer; var a,b,c,d:integer; se1,se2:set of char; begin se1:=[]; d:=0; for a:=1 to N do begin if not (upcase(s[a]) in se1)and (upcas...
by chessmaster
Mon Sep 30, 2002 4:39 pm
Forum: Pascal
Topic: input problem
Replies: 12
Views: 12626

Input and Output are two "special" files which you don't open or close. For example, let's have a problem which says "You'll have a lot of lines, in which there are two numbers a and b . Your output should be a+b for each couple". [pascal] program pXXX(input, output); var a,b,sum:integer; begin whi...
by chessmaster
Sun Sep 29, 2002 1:24 am
Forum: Pascal
Topic: input problem
Replies: 12
Views: 12626

[quote="fpnc"]It depends. Sometimes you're given a number of test cases, and you can do [pascal] for k:=1 to n do begin read(i,j); { ... do whatever you may need here ... } end; [/pascal] When not, try something like [pascal] while not eof(input) do begin read(i,j); { ... do whatever you may need he...
by chessmaster
Sat Sep 28, 2002 3:50 pm
Forum: Pascal
Topic: input problem
Replies: 12
Views: 12626

input problem

Hello, I got trouble when I meet problems with input like this

1 2
6 7
8 9

my trouble is i must repeat read until when?

repeat
read(a);
read(b);
until ???

Go to advanced search