读数问题
来源:互联网 发布:矢量gif制作软件 编辑:程序博客网 时间:2024/04/27 20:01
/*读数问题*/
//110读作一百一十需4秒,101读作一百零一需4秒,100读作一百需2秒
#include<stdio.h>
#define max 10000
char number[max];
int time=0;
FILE *fpinput,*fpoutput;
int work(int a,int b)
{
int m,n=b;
for(m = a;m > 0;m--)
{
if(number[m]=='0')
if(number[m-1]!='0')
n+=1;
if(number[m] <= '9' && number[m] > '0')
n+=2;
}
return n;
}
void main()
{
int i,num;
fpinput = fopen( "input.txt","r");
fpoutput = fopen("output.txt","w");
while(!(feof(fpinput)))
{
fscanf(fpinput,"%s",number);
for(i=0;number[i]!='/0';i++);
num=i;
for(;number[i]=='0';i--);
if(i!=num)
{
time=0;
time=work(i,time);
}
else
{
time=1;
time=work(i,time);
}
fprintf(fpoutput,"Result: %d /n",time);
}
fclose(fpinput);
fclose(fpoutput);
}
- 读数问题
- 读数
- 读数
- 关于SqlDataReader 读数据的问题
- 关于fread读数据诡异的问题
- redis读数据超时问题查询
- 记今天解决的问题:从键盘读数据
- DataStage读数据库的写进参数的问题
- python从输入框读数据的问题
- 示波器读数
- 猜读数
- 请教高手们----一个关于读数据库字段的问题,很奇怪
- 贪婪算法之0/1背包问题+读数据结构算法与应用-C++语言描述
- 解决hibernate读数据库char只显示2个字节问题
- 解决OV系列摄像头寄存器读数据无法收到的问题
- Java实现读数字的问题,输入长整型数字,输出汉语里面的读法
- Redis主从读数据不一致与hmget()获取字段为null的问题解析
- 并发带来的问题——三种常见的读数据异常现象
- 我的相思呀
- FreeBSD的安全问题-转自http://xfocus.org/
- 生产者/消费者问题在windows2000下的实现
- 用Java编写扫雷游戏--代码思想
- [水晶报表小技巧-开发-3]ASP.Net中使用水晶报表10的打印功能
- 读数问题
- 分数变小数问题
- 发现几本计算机的好书-数学基础
- MSN Messenger的圣诞贴图祝福
- 工作流应用的开发方法学
- 编译原理-现在才感受到他的重要性。
- Introducing to Spring Framework[收藏]
- Java 2源码解读:java.util.ArrayList (转)
- 封腾讯(转)