竖式问题
来源:互联网 发布:linux dd bs count 编辑:程序博客网 时间:2024/05/22 10:46
#include<stdio.h>#include<string.h>int main(){ int count=0; //计数 char s[20]; //存储输入的字符串。 char buf[99]; //存储合并后的字符串。 printf("请输入字符串s:\n"); scanf("%s",s); int x,y,z; for(int abc=111;abc<=999;abc++) { for(int de=11;de<=99;de++) { x=abc*(de%10); //乘个位的结果 y=abc*(de/10); //乘十位的结果 z=abc*de; //三位数乘两位数的结果 sprintf(buf,"%d%d%d%d%d",abc,de,x,y,z);//输出字符串(合并字符串) int ok=1; //标志位ok设置为1 for(int i=0;i<strlen(buf);i++)//获得buf的实际长度 { if(strchr(s,buf[i])==NULL)//在字符串s中查找buf[i]字符。 { ok=0; //如果找不到就将标志位设置为0 } } if(ok)//满足竖式问题的条件 { count++; printf("<%d>\n",count); printf("%5d\nX%4d\n-----\n%5d\n%4d\n-----\n%5d\n\n",abc,de,x,y,z); } } } printf("The number of solutions = %d\n",count); return 0;}
0 0
- 竖式问题
- 【3.3 竖式问题】
- 竖式问题
- 竖式问题
- 竖式问题
- 竖式表达式问题
- 竖式问题
- 竖式问题
- 竖式问题
- 竖式问题
- 竖式问题
- 竖式问题
- 竖式问题
- 竖式求解问题
- C++ 竖式问题
- 竖式问题
- 【看书】竖式问题
- 竖式问题
- C#.网络编程.TcpListener&TcpClient
- 如何把图片与压缩包合并成可改后缀名的图片文件及原理
- 【慕课笔记】第一章 JAVA初体验 第3节 使用记事本编写JAVA程序
- eclipse设置java虚拟机内存
- sublime添加直接运行语言的方法
- 竖式问题
- mongdb安装时报错
- nginx源码学习----内存池
- jQuery提示插件alertify使用指南
- Android 对象序列化 Serializable实现与Parcelabel实现的区别
- 程序员如何提高影响力:手把手教你塑造个人品牌
- RK3288改开机logo问题
- html+css学习笔记
- Linux Shell 编程语法