九度题目1026又一版A+B
来源:互联网 发布:mysql insert多条数据 编辑:程序博客网 时间:2024/05/16 10:10
#include<stdio.h>
int main(){
int he,i;
unsigned int a,b,m;
int ans[10000];
while(scanf("%d",&m)!=EOF){
if(m==0){
break;
}
scanf("%d%d",&a,&b);
he=a+b;
if(he==0){
printf("0");
}
else{
for(i=0;he!=0;i++){
ans[i]=he%m;
he=he/m;
}
i--;
while(i>=0){
printf("%d",ans[i]);
i--;
}
}
printf("\n");
}
return 0;
int main(){
int he,i;
unsigned int a,b,m;
int ans[10000];
while(scanf("%d",&m)!=EOF){
if(m==0){
break;
}
scanf("%d%d",&a,&b);
he=a+b;
if(he==0){
printf("0");
}
else{
for(i=0;he!=0;i++){
ans[i]=he%m;
he=he/m;
}
i--;
while(i>=0){
printf("%d",ans[i]);
i--;
}
}
printf("\n");
}
return 0;
}
错了好多次 改了好多次
1. 注意题目要求 三个数字都是无符号型的
2.不能忽略 A+B=0的情况
3.if else 之前没写else导致了错误
0 0
- 九度OnlineJudge题目1026:又一版 A+B
- 九度 题目1026:又一版 A+B java
- 题目 1026 又一版 A+B 九度Online Judge
- 九度 题目1026:又一版 A+B
- 九度OJ-题目1026:又一版A+B
- 九度题目1026又一版A+B
- 九度OJ题目1026:又一版A+B
- 九度 题目1026:又一版 A+B
- 九度1026:又一版 A+B
- 九度1026:又一版A+B
- 九度[1026]-又一版 A+B
- 九度oj 题目1026:又一版 A+B 【ZJU2008考研机试题1】
- 【九度OJ】题目1026:又一版 A+B 解题报告
- 题目1026:又一版 A+B
- 题目1026:又一版 A+B
- 题目1026:又一版 A+B
- 题目1026:又一版 A+B
- 43-题目1026:又一版 A+B
- Oracle利用rowid删除表中重复记录
- R文件丢失无法找回的原因
- Android界面性能调优手册
- Linux死机解决办法
- Oracle如何实现跨库查询
- 九度题目1026又一版A+B
- 机房重构—单例模式
- 8天学通MongoDB——第一天 基础入门
- Leetcode 5. Longest Palindromic Substring
- Android Broadcast详解
- Xcode快捷键
- Android开发探索第一章 Activity生命周期及启动模式总结(二)
- eclipse集成python开发环境
- iis上配置cgi