60 条题解
-
0hy__345 LV 8 @ 2014-08-03 12:09:02
easy
记录信息
评测状态 Accepted
题目 P1784 数字统计
递交时间 2014-08-03 12:07:12
代码语言 C++
评测机 VijosEx
消耗时间 15 ms
消耗内存 272 KiB
评测时间 2014-08-03 12:07:19
评测结果
编译成功测试数据 #0: Accepted, time = 0 ms, mem = 272 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 272 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 272 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 268 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 272 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 272 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 272 KiB, score = 10
测试数据 #7: Accepted, time = 15 ms, mem = 272 KiB, score = 10
测试数据 #8: Accepted, time = 0 ms, mem = 268 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 272 KiB, score = 10
Accepted, time = 15 ms, mem = 272 KiB, score = 100 -
02014-03-05 20:28:34@
#include <cstdlib>
#include <iostream>using namespace std;
int gs(int a,int b)
{
int k=0;
while(a>0)
{
if(a%10==b)
k++;
a/=10;
}
return k;
}int main(int argc,char *argv[])
{
int i,j,k=0,n,m;
cin>>n>>m;
j=2;
for(i=n;i<=m;i++)
{
k+=gs(i,j);
}
cout<<k<<endl;
// system("pause");
return 0;
}
//如果想把找2有多少个改一下,那就把j加到cin里. -
02014-01-04 18:36:33@
-
02014-01-01 12:02:34@
Vijos 题解:http://hi.baidu.com/umule/item/2c997f8ed9600fdae596e017
有疑问请留言 共同进步 -
02013-11-02 22:28:11@
var n, m,k, i: longint;
begin
readln(n, m); k := 0;
for i := n to m do begin
n := i;
while n > 0 do begin if n mod 10 = 2 then Inc(k);n := n div 10; end;
end; writeln(k);
end. -
02013-09-20 23:19:35@
Program two;
var l,r,i,j,num:integer;
s:string;Begin
readln(l,r);
for i:=l to r do begin
str(i,s);
for j:=1 to length(s) do
if s[j]='2' then num:=num+1;
end;
writeln(num);
End. -
02013-09-16 22:36:22@
#include <iostream>
using namespace std;int main()
{
int x,y;
cin>>x>>y;
int count=0;
for(int i=x;i<=y;i++)
{
if (i/1000==2)
count++;
if (i%1000/100==2)
count++;
if (i%1000%100/10==2)
count++;
if (i%1000%100%10==2)
count++;
}
cout<<count<<endl;
return 0;
} -
02013-08-31 20:49:06@
#include <iostream>
#include <stdio.h>
using namespace std;
int l,r,i,j,k,b,a,sum;
int main(){
cin>>l;
cin>>r;
sum=0;
for(i=l;i<=r;i++){
a=i;
do
{b=a%10;
if (b==2){
sum++;
}
a/=10;}
while(a!=0);
}
cout<<sum<<endl;
}
b表示取i(a)的每一位
如果是2就累加 -
02013-08-06 14:29:37@
刷水题神马的最有自信了O(∩_∩)O~
-
02013-07-15 18:27:11@
var l,r,x:integer;
begin
x:=0;
readln(l,r);
l:=l-1;
for l:=l+1 to r do
begin
if l mod 10=2 then x:=x+1;
if l div 10=2 then x:=x+1;
if l div 100=2 then x:=x+1;
if l div 1000=2 then x:=x+1;
end;
write(x);
end.
为啥只有30? -
02013-07-07 21:42:38@
喵了个咪,居然是标准输入输出。那题干里还提输入输出文件。。
好久不刷题站了都忘了规矩了 -
02012-11-25 20:24:29@
├ 测试数据 01:答案正确... (156ms, 404KB)
├ 测试数据 02:答案正确... (31ms, 404KB)
├ 测试数据 03:答案正确... (47ms, 404KB)
├ 测试数据 04:答案正确... (0ms, 404KB)
├ 测试数据 05:答案正确... (16ms, 404KB)
├ 测试数据 06:答案正确... (0ms, 404KB)
├ 测试数据 07:答案正确... (31ms, 404KB)
├ 测试数据 08:答案正确... (16ms, 404KB)
├ 测试数据 09:答案正确... (47ms, 404KB)
├ 测试数据 10:答案正确... (47ms, 404KB) -
02012-11-22 18:13:56@
这题本人上传的!
首先,我们可以让一个变量从最小值循环制最大值,然后把每个循环到的数字转换为字符串,再用一个变量循环,判断每一位是否为2,是就加1!
很水的 -
02012-11-20 17:56:09@
var
s,n,q,e,l:integer;
w:string;
begin
read(s,n);
for q:=s to n do begin
str(q,w);
for e:=1 to length(w)do if w[e]='2' then l:=l+1;
end;writeln(l);
end.AC31 一星纪念
-
02012-11-19 18:17:43@
├ 测试数据 01:答案正确... (0ms, 676KB)
├ 测试数据 02:答案正确... (15ms, 676KB)
├ 测试数据 03:答案正确... (0ms, 676KB)
├ 测试数据 04:答案正确... (15ms, 676KB)
├ 测试数据 05:答案正确... (0ms, 676KB)
├ 测试数据 06:答案正确... (0ms, 676KB)
├ 测试数据 07:答案正确... (15ms, 676KB)
├ 测试数据 08:答案正确... (15ms, 676KB)
├ 测试数据 09:答案正确... (15ms, 676KB)
├ 测试数据 10:答案正确... (15ms, 676KB)这题......真是水额,5分钟AC
-
02012-11-18 19:26:28@
├ 测试数据 01:答案正确... (13ms, 672KB)
├ 测试数据 02:答案正确... (14ms, 672KB)
├ 测试数据 03:答案正确... (12ms, 672KB)
├ 测试数据 04:答案正确... (31ms, 672KB)
├ 测试数据 05:答案正确... (13ms, 672KB)
├ 测试数据 06:答案正确... (0ms, 672KB)
├ 测试数据 07:答案正确... (0ms, 672KB)
├ 测试数据 08:答案正确... (15ms, 672KB)
├ 测试数据 09:答案正确... (0ms, 672KB)
├ 测试数据 10:答案正确... (0ms, 672KB)---|---|---|---|---|---|---|---|-
Accepted / 100 / 101ms / 672KB
农夫山泉有点甜
第二个AC -
-12017-03-15 17:03:24@
var a,b,t,i,s:longint;
begin
read(a,b);
for i:=a to b do
begin
t:=i;
while t>0 do
begin
if t mod 10=2 then inc(s);
t:=t div 10;
end;
end;
write(s);
end. -
-12016-12-19 20:20:28@
一组要把数组开大。。。。开10000一直过不了。。。。因为数组10000的值是你输入的第二值的值。。。。所以一定多开一个
```c
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int m,n;
int i,j;
int k;
int sh[10001]= {0};
for(i=1; i < 10000; i++)
{
j=i;
k=0;
while(j != 0)
{
if(j%10 == 2)
{
if(k == 0){sh[i]=1;k = 1;}
else sh[i]++;
}
j /= 10;
}
// printf("i = %d sh[i] = %d\n",i,sh[i]);
}
scanf("%d%d",&m,&n);
int sum=0;
// printf("%d",sh[10000]);
for(i=m; i <= n; i++)
{
if(sh[i] > 0) sum += sh[i];
}
printf("%d\n",sum);return 0;
} -
-12016-10-31 17:31:12@
题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题
题题题题题题题题题题题题题题题题题题题题题题题题题题题题水水水水题题题题题
题题题题题题题题题题题题题题题题题题题题题题题题水水水水水水水水水题题题题
题题题题题题题题题题题题题题题题题题水水水水水水水水水水水水水水水题题题题
题题题题题题题题题题题题题题题题水水水水水水水水水水水水水水水题题题题题题
题题题题题题题题题题题水水水水题水水水水水水水水水水水题题题题题题题题题题
题题题题题题题题水水水水水水水题水水水题题水水水水水题题题题题题题题题题题
题题题水水水水水水水水水水水水题题题题题题水水水水题题题题题题题题题题题题
题水水水水水水水水水水水水水水题题题题题题水水水水题题题题题题题题题题题题
题水水水水水水水水水水水水题题题题题题题水水水水水水水水水水水题题题题题题
题水水水水水水水水水水水水题题题题题题水水水水水水水水水水水水水水题题题题
题题水水水水水水水水水水题题题题题水水水水水水题题题水水水水水水水题题题题
题题题题题题题题水水水水题题题题题水水水水题题题题题题水水水水水题题题题题
题题题题题题题题水水水水题题题题水水水水题题水水题题题水水水水水题题题题题
题题题题题题题题水水水水题题题题水水水水题题水水水水题水水水水水题题题题题
题题题题题题题题水水水水题题题题水水水水题题水水水水题水水水水水题题题题题
题题题题题题题题水水水水题题题题水水水水题题水水水题题水水水水水题题题题题
题题题题题题题题水水水水题题题题水水水水题题水水水题题水水水水水题题题题题
题题题题题题题题水水水水题题题题水水水水题水水水水题题水水水水水题题题题题
题题题题题题题题水水水水题题题题水水水水题水水水水题题水水水水水题题题题题
题题题题题题题题水水水水题题题题水水水水题水水水水题题水水水水水题题题题题
题题题题题题题题水水水水题题题题水水水水题水水水水题题水水水水水题题题题题
题题题题题题题题水水水水题题题题水水水题题水水水水题题水水水水水题题题题题
题题水水题题题水水水水水题题题题水水水题题水水水题题题水水水水水题题题题题
题题水水水水水水水水水水题题题题题水水题题水水题题题题水水水水水题题题题题
题题题水水水水水水水水水题题题题题题题题水水水题题题题水水水水题题题题题题
题题题题题水水水水水水水题题题题题题题题水水水题水水水水题题题题题题题题题
题题题题题题水水水水水水题题题题题题题水水水水题题水水水水题题题题题题题题
题题题题题题题题题水水水题题题题题题水水水水水题题题水水水水水水水题题题题
题题题题题题题题题题题题题题题题水水水水水水题题题题题水水水水水水题题题题
题题题题题题题题题题题题题题题水水水水水水题题题题题题水水水水水水水题题题
题题题题题题题题题题题题题题水水水水水题题题题题题题题题水水水水水水题题题
题题题题题题题题题题题题题水水水水水题题题题题题题题题题题水水水水题题题题
题题题题题题题题题题题题水水水题题题题题题题题题题题题题题题水水水题题题题
题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题题 -
-12016-08-21 10:08:41@
真的太水
var
l,r,i,j,n,ans:longint;
s:string;
begin
readln(l,r);
for i:=l to r do begin
str(i,s);
n:=length(s);
for j:=1 to n do begin
if s[j]='2' then inc(ans);
end;
end;
writeln(ans);
end.