竖式问题
来源:互联网 发布:免费男士发型设计软件 编辑:程序博客网 时间:2024/05/28 15:34
B.竖式问题Time Limit: 1000 MSMemory Limit: 32768 KTotal Submit: 1(1 users)Total Accepted: 1(1 users)Special Judge: NoDescription
竖式问题是:有被乘数xyz和乘数ab(xyzab是被乘数和乘数的各位数字),则xyz乘以ab所得的算式:即竖式中的中间结果和最终结果(即乘积)中的数字均为一给定字符串之中的数字。请找出这样的竖式。被乘数、乘数和结果中各位数字可以重复。
Input输入一给定字符串作为竖式问题的限定条件。Output如果找到满足条件的竖式,输出满足条件的竖式数,如果没有满足条件的竖式,输出noneSample Input12
3456
345678
Sample Output
The number of solutions = 1
none.
The number of solutions = 15
#include <stdio.h>#include <string.h>int main(){ int abc, de, x, y, z, i, ok, count; char s[20], buff[100]; while(~scanf("%s", s)) { count = 0; for (abc = 100; abc < 999; abc++) { for (de = 10; de < 99; de++) { x = abc * (de % 10); y = abc * (de / 10); z = abc * de; sprintf(buff, "%d%d%d%d%d", abc, de, x, y, z); ok = 1; for (i = 0; i < strlen(buff); i++) if (strchr(s, buff[i]) == NULL) ok = 0; if (ok) { ++count; // printf("%5d/nX%4d/n-----/n%5d/n%4d/n-----/n%5d/n", abc, de, x, y, z); } } } if(count == 0) printf("none.\n"); else printf("The number of solutions = %d\n", count); } return 0;}
0 0
- 竖式问题
- 【3.3 竖式问题】
- 竖式问题
- 竖式问题
- 竖式问题
- 竖式表达式问题
- 竖式问题
- 竖式问题
- 竖式问题
- 竖式问题
- 竖式问题
- 竖式问题
- 竖式问题
- 竖式求解问题
- C++ 竖式问题
- 竖式问题
- 【看书】竖式问题
- 竖式问题
- pyton利用pyqt5的QWebkit抓取javascript执行后的动态网页
- 《梦想合伙人》点映礼 姚晨或为美利金融有用分期代言
- NKOI 1599 最大身高
- 工信部发证 中国广电成第四大基础电信运营商
- subline使用2 代码跟踪
- 竖式问题
- 五大算法区别
- 求助】安卓开发异常 java.lang.Throwable: stack dump
- CSS3:color
- Hdu 2795 Billboard
- Inflater
- HttpClient使用详解 (了解)
- 编写filter,处理get和post中文乱码问题
- 今天要说的是adapter.Fill(DataSet)中缺参数的问题