当前位置:网站首页>刷题-洛谷-P1179 数字统计
刷题-洛谷-P1179 数字统计
2022-08-04 19:44:00 【宋向上_UP】
P1179 数字统计-C语言
1、题目
2、解题过程
结果:
代码:
//洛谷 P1179 数字统计
#include <stdio.h>
//#define MIN 1
//#define MAX 100000
int main() {
int l, r;//给定范围
int counter=0;//计数器
int i;
int temp,temp_2;
scanf("%d %d", &l, &r);
for (i = l; i <= r; i++) {
temp = i;
while (temp != 0) {
temp_2 = temp % 10;
if (temp_2 == 2) {
counter++;
}
temp = temp / 10;
}
}
printf("%d", counter);
return 0;
}
边栏推荐
猜你喜欢
Ant Group's time series database CeresDB is officially open source
使用 Allatori 进行 Jar 包混淆
《支付宝体验设计精髓》一书,跟测试相关性知识记录
ERC20转账压缩
PG网络传输安全SSL介绍及使用示例
量化交易机器人系统开发
IIC驱动OLED
Quantitative trading robot system development
getBoundingClientRect
Use "green computing" technology to promote sustainable development of computing power
随机推荐
如何让远在的老板看到你!----------来自财富中国网
The book "The Essence of Alipay Experience Design", a record of knowledge related to testing
【Attention 演变史】RNN的产生、架构、推广、问题(第一弹)
SAP UI5 确保控件 id 全局唯一的实现方法
Internship: changed the requirements
MMDetection usage example: from entry to exit
重构指标之如何监控代码圈复杂度
The list of Kubernetes - watch mechanism
电脑一键重装系统后连不上远程了?教你设置的方法
The Development and Current Situation of Object Detection
宏定义小方法
面试官:JVM运行时数据区包含哪几部分?作用是啥?
PG网络传输安全SSL介绍及使用示例
A complete cross-compilation environment records the shell scripts generated by peta
笔记本WIFI无法上网(无Internet访问权限)
Initialization process of SAP UI5
正则表达式未完
Orthodontic MIA micro-implant anchorage technology China 10th anniversary exchange meeting was held in Shenyang
二叉树的前序遍历
蚂蚁集团时序数据库CeresDB正式开源