当前位置:网站首页>刷题-洛谷-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;
}
边栏推荐
- 《支付宝体验设计精髓》一书,跟测试相关性知识记录
- Switch node version and switch npm source tool
- 六月 致 -.-- -..- -
- T+Cloud: A "Smart Company" for Building New Business Social Networks and Marketing Relationships
- If it is test axi dma catch a few words here
- 泰山OFFICE技术讲座:底纹、高亮、边框的关系
- awk statistical average max min
- 如何给MySQL添加自定义语法 ?
- 量化交易机器人系统开发
- 笔记本WIFI无法上网(无Internet访问权限)
猜你喜欢

Openharmony first experience (1)

图片延迟加载、预加载

Go学习笔记(篇一)配置Go开发环境

量化交易机器人系统开发

正畸MIA微种植体支抗技术中国10周年交流会在沈举办

"WAIC 2022 · hackers marathon" two ants wealth competition invited you to fight!

Orthodontic MIA micro-implant anchorage technology China 10th anniversary exchange meeting was held in Shenyang

视频目标检测

运维就业现状怎么样?技能要求高吗?

Yuanguo chain game system development
随机推荐
电脑一键重装系统内存完整性无法打开怎么办
Switch node version and switch npm source tool
Quantitative trading robot system development
六月 致 -.-- -..- -
[Latest Information] 2 new regions will announce the registration time for the soft exam in the second half of 2022
备忘录模式
The Development and Current Situation of Object Detection
JSD-2204-酷莎商城(管理员模块)-密码加密-Day10
The establishment of simple data cache layer
nr part calculation
VQ Realization of Wavelet Extraction Features
Kubernetes之list-watch机制
In July 2022, domestic database memorabilia
PostgreSQL的 SPI_接口函数
How to promote the implementation of rural revitalization
C#弹出询问对话框
《支付宝体验设计精髓》一书,跟测试相关性知识记录
如何使用 jMeter Parallel Controller - 并行控制器以及一些常犯的错误
二叉树的前序遍历
Jmeter - Heap配置原因报错Invalid initial heap size: -Xms1024m -Xmx2048mError