割数问题——C语言版
来源:互联网 发布:phpstorm php配置 编辑:程序博客网 时间:2024/05/17 04:29
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
//count 用来计量数字的位数
//a 用来计量输入的个数
//b 用来循环的输入数字
//num[] 用来存放数字
//one[] 用来存放每个数的每一位的数字
//n[] 用来将每一位的位数进行存放
int count,b,a;
int num[100],one[100][100],n[100];
scanf("%d",&a);
for(int i=0;i<a;i++){
scanf("%d",&b);
num[i]=b;
}
for(int i=0;i<a;i++){
int temp;
temp = num[i];
for(int j=0;temp>=1;j++){
one[i][j] = temp%10;
count++;
temp=temp/10;
}
n[i]=count;
count = 0;
}
for(int i=0;i<a;i++){
int num1=0,num2=0;
for(int j=0;j<n[i]/2;j++){
num1=num1+pow(10,j)*one[i][j];
}
for(int j=n[i]/2;j<=n[i];j++){
num2=num2+pow(10,j-n[i]/2)*one[i][j];
}
int t= num1*num2;
if(num[i]%t==0){
printf("Yes\n");
}else{
printf("No\n");
}
}
return 0;
}
#include<string.h>
#include<math.h>
int main(){
//count 用来计量数字的位数
//a 用来计量输入的个数
//b 用来循环的输入数字
//num[] 用来存放数字
//one[] 用来存放每个数的每一位的数字
//n[] 用来将每一位的位数进行存放
int count,b,a;
int num[100],one[100][100],n[100];
scanf("%d",&a);
for(int i=0;i<a;i++){
scanf("%d",&b);
num[i]=b;
}
for(int i=0;i<a;i++){
int temp;
temp = num[i];
for(int j=0;temp>=1;j++){
one[i][j] = temp%10;
count++;
temp=temp/10;
}
n[i]=count;
count = 0;
}
for(int i=0;i<a;i++){
int num1=0,num2=0;
for(int j=0;j<n[i]/2;j++){
num1=num1+pow(10,j)*one[i][j];
}
for(int j=n[i]/2;j<=n[i];j++){
num2=num2+pow(10,j-n[i]/2)*one[i][j];
}
int t= num1*num2;
if(num[i]%t==0){
printf("Yes\n");
}else{
printf("No\n");
}
}
return 0;
}
阅读全文
0 0
- 割数问题——C语言版
- 51Nod:活动安排问题——c语言版
- c语言版——四则运算
- 魔方问题 C语言版
- 割数问题
- bnu1268 种树问题 C语言版
- 皇后问题(c语言版)
- 重读数据结构——严蔚敏C语言版
- 蓝桥杯数独游戏——C语言版
- 单片机数码管动态显示—C语言版
- 算法—振兴中华(C语言版)
- bnu1056 两数之差 C语言版
- 求斐波那契数(fibonacci)--c语言版
- PAT 乙级 1013. 数素数 (C语言版)
- 51Nod:活动安排问题(二)——c语言版
- 八皇后问题 回溯递归 C语言版
- 0 1背包问题 C语言版
- C语言版随机分配座位问题
- AlertDialog
- 利用C3P0数据源来作连接池,简单的写一个数据库操作来描述分层思想
- 割数问题
- (生产者消费者)线程池、 多线程读写线程
- 在JS中typeof返回的结果有哪几种?
- 割数问题——C语言版
- FTPrep, 76 Minimum Window Substring
- ListDialog设置字体大小
- Scratch零基础课程1-“喵星人”奔跑代码解析
- Linux虚拟机联网设置
- Result dubbo接口返回类型的设计
- 在Ubantu上安装oracle客户端工具sqlplus
- 30天自制操作系统-第0天心得笔记
- 装饰器之认祖归宗