16 条题解
- 
  0Empire-003 LV 9 @ 2017-06-07 10:32:18 /*C++强行水过*/ #include <iostream> using namespace std; int main() { string str; int count = 0; while(str != "begin") { getline(cin, str); for(int i = 0; i < str.size(); i++) if(str[i] == ',' || str[i] == ':') count++; } cout << count << endl; return 0; }
- 
  0@ 2016-11-30 16:57:42#include <algorithm> #include <iostream> #include <string> using namespace std; int main() { int ans = 0; string str; while (getline(cin,str),str != "begin") ans += count(str.begin(),str.end(),',')+count(str.begin(),str.end(),':'); cout << ans; return 0; }
- 
  0@ 2016-07-14 09:52:34#include<iostream> 
 #include<cstdio>
 #include<cstring>
 using namespace std;
 string s;
 int main()
 {
 int n=0;
 while(cin>>s)
 {
 for(int i=1;i<=s.size();i++)
 {
 if(s[i]==','||s[i]==':')
 {
 n++;
 }
 }
 if(s=="begin")
 break;
 }cout<<n; 
 }
- 
  0@ 2016-03-27 09:06:44测试数据 #0: Accepted, time = 0 ms, mem = 568 KiB, score = 10 
 测试数据 #1: Accepted, time = 0 ms, mem = 572 KiB, score = 10
 测试数据 #2: Accepted, time = 0 ms, mem = 572 KiB, score = 10
 测试数据 #3: Accepted, time = 0 ms, mem = 572 KiB, score = 10
 测试数据 #4: Accepted, time = 0 ms, mem = 572 KiB, score = 10
 测试数据 #5: Accepted, time = 0 ms, mem = 572 KiB, score = 10
 测试数据 #6: Accepted, time = 0 ms, mem = 572 KiB, score = 10
 测试数据 #7: Accepted, time = 0 ms, mem = 572 KiB, score = 10
 测试数据 #8: Accepted, time = 0 ms, mem = 572 KiB, score = 10
 测试数据 #9: Accepted, time = 0 ms, mem = 576 KiB, score = 10
 Accepted, time = 0 ms, mem = 576 KiB, score = 100
 代码
 #include<iostream>
 #include<cstdio>
 #include<string>
 using namespace std;
 int tot=0;
 string s;
 int main()
 {
 //freopen("water.in","r",stdin);
 //freopen("water.out","w",stdout);
 while(cin>>s,s!="begin")
 for(int i=0;i<s.size();i+=1)
 if(s[i]==',' || s[i]==':') tot+=1;
 printf("%d",tot);
 //fclose(stdin); fclose(stdout);
 return 0;
 }
- 
  0@ 2016-03-13 12:11:59var s,i:longint; 
 x:string;
 begin
 s:=0;
 while not eof do
 begin
 readln(x);
 for i:=1 to length(x) do
 if (x[i]=',')or(x[i]=':') then inc(s);
 if x='begin' then begin
 write(s);
 exit;
 end;
 end;
 end.
- 
  0@ 2015-04-27 20:47:43真的有那么水么? 
 ###pascal code
 program p1762;
 var s:string; ans:int64; i,j:longint;
 begin
 ans:=0;
 for i:=1 to 2000 do begin
 readln(s); for j:=length(s) downto 1 do if (s[j]=',') or (s[j]=':') then inc(ans);
 if s='begin' then break;
 end;
 write(ans);
 end.
- 
  0@ 2015-04-27 20:44:54。。。AC.... 
 var a:char;
 k,ans:integer;
 o:boolean;
 Begin
 k:=1;
 ans:=0;
 o:=false;
 while not o do
 begin
 read(a);
 case k of
 1: begin if (a='b') or (a='B') then inc(k); end;
 2: begin if (a='e') or (a='E') then inc(k) else k:=1; end;
 3: begin if (a='g') or (a='G') then inc(k) else k:=1; end;
 4: begin if (a='i') or (a='I') then inc(k) else k:=1; end;
 5: begin if (a='n') or (a='N') then o:=true else k:=1; end;
 end;
 if (a=':') or (a=',') then ans:=ans+1;
 end;
 writeln(ans);
 End.
- 
  0@ 2014-08-06 15:34:52AC 
 (我不懂pascal)
 #include <iostream>
 #include <cstring>
 using namespace std;int main() 
 {
 char line[256];
 bool p = true;
 int cnt = 0;ios::sync_with_stdio(false); 
 cin.getline(line, 256);
 while(!(cin.getline(line, 256).fail()))
 {
 if (!p)
 continue;
 if (!strcmp(line, "begin"))
 {
 p = false;
 continue;
 }
 for (int i = 0; i < (int)strlen(line); i++)
 {
 if ((line[i] == ',') || (line[i] == ':'))
 cnt++;
 }
 }
 cout << cnt << endl;
 return 0;
 }
- 
  0@ 2013-11-08 10:04:46var 
 s,s1:ansistring;
 ans,i:longint;
 begin
 while not(eof) do
 begin
 readln(s1);
 if pos('begin',s1)>0 then break;
 s:=s+s1;
 end;
 ans:=0;
 for i:=1 to length(s) do
 if (s[i]=',') or (s[i]=':') then inc(ans);
 writeln(ans);
 end.
 这是我们绍一中的凌神出的题。
 虽然水,自然要顶!
 顶!!!!!!!!!!!!
 By JSB
- 
  0@ 2013-11-03 10:30:13var 
 i,j,n,m,ans:longint;
 s:ansistring;
 begin
 n:=0;m:=0;
 while pos('begin',s)=0 do
 begin
 readln(s);
 for i:=1 to length(s) do
 if s[i]=',' then ans:=ans+1;
 for i:=1 to length(s) do
 if s[i]=':' then ans:=ans+1;
 end;
 writeln(ans);
 end.
 var
 i,j,n,m,ans:longint;
 s:ansistring;
 begin
 n:=0;m:=0;
 while pos('begin',s)=0 do
 begin
 readln(s);
 for i:=1 to length(s) do
 if s[i]=',' then ans:=ans+1;
 for i:=1 to length(s) do
 if s[i]=':' then ans:=ans+1;
 end;
 writeln(ans);
 end.查找',' ':'的位置,统计数量即可。 
- 
  0@ 2012-11-09 20:05:4701 var 02 s:string; 03 q,v,b,e,l:integer; 04 begin 05 e:=0; 06 v:=0; 07 l:=0; 08 b:=0; 09 while pos('begin',s)=0 do begin 10 readln(s); 11 e:=v; 12 for q:=1 to length(s) do if s[q]=','then v:=v+1; 13 if ve then b:=b+1; 14 if v=e then for q:=1 to length(s)do if s[q]=':'then l:=l+1; 15 end; 16 if v0 then writeln(l+v+b); 17 if v=0 then writeln(l); 18 end. 
- 
  0@ 2012-11-05 18:11:10这题是想逆天啊还是怎么的 
- 
  0@ 2012-11-04 21:44:34我只能说 数据不好。。。 
 不过作为70T 留下名吧。。。
 我建议出题者 可以改成判断是否CE(偷笑)
- 
  0@ 2012-11-04 21:21:54├ 测试数据 01:答案正确... (0ms, 408KB) 
 ├ 测试数据 02:答案正确... (0ms, 408KB)
 ├ 测试数据 03:答案正确... (0ms, 408KB)
 ├ 测试数据 04:答案正确... (0ms, 408KB)
 ├ 测试数据 05:答案正确... (0ms, 408KB)
 ├ 测试数据 06:答案正确... (0ms, 408KB)
 ├ 测试数据 07:答案正确... (0ms, 408KB)
 ├ 测试数据 08:答案正确... (0ms, 408KB)
 ├ 测试数据 09:答案正确... (0ms, 408KB)
 ├ 测试数据 10:答案正确... (0ms, 408KB)---|---|---|---|---|---|---|---|- 
 Accepted / 100 / 0ms / 408KB
 这题第三个点猥琐的在begin前加了空格
 于是我就WA了一次
 加上删前缀空格AC了……
 话说数据很弱啊,连个type、const什么的都没有
 begin只有前缀空格,没有后缀空格
- 
  0@ 2012-11-09 19:22:48声明一下,begin前是没有空格的,第三个点是样例,楼下的自己搞错了吧 
- 
  0@ 2012-11-04 20:19:28不愧为通过率100%的题啊! 
 真简单,连数组都不用考虑(更不用说过程和函数了)
 AC38题纪念!(这个)
 首先读入,读到begin就不用读了(不懂的可以研究P1000去,变量定义在主程序前)
 然后一行一行判断,有,或:就把累加变量加一......
 直到判断完为止
 第一次前十个AC题,第一次坐沙发)
- 1