当前位置:网站首页>Character conversion PTA
Character conversion PTA
2022-07-05 22:14:00 【Sophomore to major】
This problem requires the extraction of all numeric characters in a string ('0'……'9'), Convert it to an integer output .
Input format :
The input gives no more than 80 Character string ending with carriage return .
Output format :
Output the converted integer on one line . Ensure that the output does not exceed the long integer range .
sample input :
#include <stdio.h>
int main(){
char ch[81];
int i=0,sum=0;
while((ch[i]=getchar())!='\n'){
if(ch[i]>='0'&&ch[i]<='9'){
sum=sum*10+ch[i]-'0';
}
i++;
}
printf("%d",sum);
return 0;
}free82jeep5
sample output :
825Ideas : Use it directly first putchar(), trouble , It's much simpler after changing to numerical value ;
边栏推荐
- Pl/sql basic syntax
- 如何開發引入小程序插件
- Search: Future Vision (moving sword)
- Oracle checkpoint queue - Analysis of the principle of instance crash recovery
- 多家呼吸机巨头产品近期被一级召回 呼吸机市场仍在增量竞争
- What about data leakage? " Watson k'7 moves to eliminate security threats
- 854. String BFS with similarity K
- Kubernetes Administrator certification (CKA) exam notes (IV)
- Cobaltstrike builds an intranet tunnel
- 科技云报道:算力网络,还需跨越几道坎?
猜你喜欢

The statistics of leetcode simple question is the public string that has appeared once

Meituan dynamic thread pool practice ideas, open source

Serializability of concurrent scheduling

database mirroring

Technology cloud report: how many hurdles does the computing power network need to cross?

A number of ventilator giants' products have been recalled recently, and the ventilator market is still in incremental competition

Web3为互联网带来了哪些改变?

How to view Apache log4j 2 remote code execution vulnerability?

2022-07-05:给定一个数组,想随时查询任何范围上的最大值。 如果只是根据初始数组建立、并且以后没有修改, 那么RMQ方法比线段树方法好实现,时间复杂度O(N*logN),额外空间复杂度O(N*

Oracle triggers
随机推荐
2022-07-05:给定一个数组,想随时查询任何范围上的最大值。 如果只是根据初始数组建立、并且以后没有修改, 那么RMQ方法比线段树方法好实现,时间复杂度O(N*logN),额外空间复杂度O(N*
Implementation technology of recovery
如何向mongoDB中添加新的字段附代码(全)
PyGame practical project: write Snake games with 300 lines of code
How to organize an actual attack and defense drill
What if win11 is missing a DLL file? Win11 system cannot find DLL file repair method
微服务入门(RestTemplate、Eureka、Nacos、Feign、Gateway)
让开发效率提升的跨端方案
Sub total of Pico development
database mirroring
Matlab draws a cute fat doll
AD637使用筆記
Installation of VMware Workstation
Daily question brushing record (XIV)
Wonderful review of the digital Expo | highlight scientific research strength, and Zhongchuang computing power won the digital influence enterprise award
Oracle triggers
数据泄露怎么办?'华生·K'7招消灭安全威胁
The statistics of leetcode simple question is the public string that has appeared once
CRM creates its own custom report based on fetch
Solutions for unexplained downtime of MySQL services