文章

11

粉丝

0

获赞

13

访问

645

头像
数字统计 题解:
P1002 兰州大学机试题
发布于2025年3月11日 15:23
阅读数 17

#include<stdio.h>
#include<stdlib.h>

int times;

void suan(int lll,int rrr){
	times=0;
	for(int i=lll;i<=rrr;i++){
		int zanc=i;
		while(zanc){
			if(zanc%10==2){
				times++;
			}
			zanc/=10;
		}
	}
}

int main(){
	int l,r;
	while(scanf("%d %d",&l,&r)!=EOF){
		suan(l,r);
		printf("%d\n",times);
	}
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发