Mixed Fractions

You are part of a team developing software to help students learn basic mathematics. You are to write one part of that software, which is to display possibly improper fractions as mixed fractions. A proper fraction is one where the numerator is less than the denominator; a mixed fraction is a whole number followed by a proper fraction. For example the improper fraction 27/12 is equivalent to the mixed fraction 2 3/12. You should not reduce the fraction (i.e. don’t change 3/12 to 1/4).

Input

Input has one test case per line. Each test case contains two integers in the range [1,231−1][1,231−1]. The first number is the numerator and the second is the denominator. A line containing 0 00 0 will follow the last test case.

Output

For each test case, display the resulting mixed fraction as a whole number followed by a proper fraction, using whitespace to separate the output tokens.

Sample Input 1 Sample Output 1
27 12
2460000 98400
3 4000
0 0
2 3 / 12
25 0 / 98400
0 3 / 4000

题意

把给出的分数化成整数和真分数的形式

代码

#include<bits/stdc++.h>
using namespace std;
int main() {
long long n, m;
while(cin >> n >> m) {
if(n == m && n == )
break;
long long cnt = ;
if(n >= m) {
cnt = n / m;
n = n - cnt * m;
}
printf("%d %d / %d\n", cnt, n, m);
}
}

最新文章

  1. 共享MFC dULL
  2. linux 学习随笔-系统日常管理常用命令
  3. Socket.IO 1.0 正式发布,快速可靠的实时引擎
  4. python 练习 27
  5. eclipse报An error has occurred,See error log for more details. java.lang.NullPointerException错误
  6. setbuf
  7. 【Python3】SMTP发送邮件
  8. OpenGL入门学习(转)
  9. 关于 angular 小心得
  10. (转)安装程序发布利器——InstallShield 2011 Limited Edition
  11. D - Digging(01背包,贪心)
  12. MySQL 主从复制与读写分离概念及架构分析 (转)
  13. Docker镜像仓库清理的探索之路
  14. c#判断是否有网络
  15. Python sqlalchemy orm 常用操作
  16. KNN算法简介
  17. 【原创】backbone1.1.0源码解析之Events
  18. npm ERR! Error extracting ~/.npm/cloudant/1.9.0/package.tgz archive: ENOENT: no such file or directory, open &#39;~/.npm/cloudant/1.9.0/package.tgz&#39;
  19. java AES加密、解密(兼容windows和linux)
  20. php 备份和恢复数据库

热门文章

  1. webstorm主题网址
  2. 【数据分析学习】Pandas思维导图
  3. Vue学习之路第十五篇:v-if和v-show指令
  4. HDU2188 - 悼念512汶川大地震遇难同胞——选拔志愿者【巴什博弈】
  5. nyoj158-省赛来了
  6. Linux 查看用户命令
  7. 玩家福音:10款最佳Linux免费游戏
  8. 新手学python-Day1-鸡汤,变量,编码,进制,判断
  9. 手机上怎么去掉a 标签中的img点击时的阴影?
  10. String 字符串的追加,数组拷贝