1 / 8

题 1114 : 【 入门 】 数字和 Description 输入一个很大的数,求各位上的数字和。 Input 一个很大的整数(不超过 200 位) Output 一个整数

题 1114 : 【 入门 】 数字和 Description 输入一个很大的数,求各位上的数字和。 Input 一个很大的整数(不超过 200 位) Output 一个整数 Sample Input 123 Sample Output 6. t:=ord(st[i])-48;. t:=ord(st[i])-48;. 字符转换成数字 ord 数字转换成字符 chr. program ex1114; var st,st1:string; i,t,len:integer; s:longint; begin readln(st);

Download Presentation

题 1114 : 【 入门 】 数字和 Description 输入一个很大的数,求各位上的数字和。 Input 一个很大的整数(不超过 200 位) Output 一个整数

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 题1114:【入门】数字和 Description 输入一个很大的数,求各位上的数字和。 Input 一个很大的整数(不超过200位) Output 一个整数 Sample Input 123 Sample Output 6 t:=ord(st[i])-48;

  2. t:=ord(st[i])-48; 字符转换成数字 ord 数字转换成字符 chr program ex1114; var st,st1:string; i,t,len:integer; s:longint; begin readln(st); len:=length(st); s:=0; for i:=1 to len do begin St1:= copy(st,i,1); val(st1,t); s:=s+t; end; write(s); end. 截一位下来,也是字符串 转换成数字 字符串转换成数字val(st,x) 数字转换字符串 str(x,st);

  3. var st:string; len,i,sum:integer; begin readln(st); len:=length(st); i:=1;sum:=0; while i<=len do begin while (st[i]=' ') and (i<=len) do inc(i); if i<=len then inc(sum); while (st[i]<>' ') and (i<=len)do inc(i); end; writeln(sum); end. 读程序 i sum The strong pass of the enemy is like a wall of iron, yet with firm strides, we are conquering its summit. My way ahead is long; I see no ending; yet high and low I'll search with my will unbending.

  4. 2004年温家宝总理答中外记者 今后工作: 雄关漫道真如铁,而今迈步从头越;路漫漫其修远兮,吾将上下而求索。 The strong pass of the enemy is like a wall of iron, yet with firm strides, we are conquering its summit. My way ahead is long; I see no ending; yet high and low I'll search with my will unbending

  5. 4-26输入一行字符,包含若干个单词,约定相邻的两个单词间用若干个空格隔开。编程统计其中单词的个数

  6. 题1188:【基础】高精度加法 计算a+b的值,a,b 皆不超过240位。 Input 两个数 每行一个 Output 一个数 Sample Input 111111111111111111111111111111111111 222222222222222222222222222222222222 Sample Output 333333333333333333333333333333333333 8946 159 + a 1111111111111111111111111 2222222222222222222222222 进位 b

  7. program ex1188; var st1,st2:string; a,b:array[1..250] of integer; len1,len2,len,c,i:integer; begin readln(st1); len1:=length(st1); readln(st2); len2:=length(st2); for i:=1 to len1 do a[i]:=ord(st1[len1-i+1])-48; for i:=1 to len2 do b[i]:=ord(st2[len2-i+1])-48; if len1>len2 then len:=len1 else len:=len2; c:=0; for i:=1 to len do begin a[i]:=a[i]+b[i]+c; c:=a[i] div 10; a[i]:=a[i] mod 10; end; if c<>0 then write(c); for i:=len downto 1 do write(a[i]); end.

More Related