#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
char s[];
long long t, y;
long long gcd(long long a, long long b)
{
long long t;
while (b)
{
t = a%b;
a = b;
b = t;
}
return a;
}
int main()
{
int sb;
scanf("%d", &sb);
while (sb--)
{
long long i;
scanf("%s", s);
t = , y = ;
long long len = strlen(s);
for (i = ; i < len; i++)
{
if (s[i] == '.') break;
t = t * + s[i] - '';
}
long long o = ;
for (; i < len; i++)
{
if (s[i] == '.') continue;
y = y * + s[i] - '';
o++;
}
long long e = ;
for (i = ; i <= o; i++) e = e * ;
printf("%lld/%lld\n", (t*e + y) / gcd(t*e + y, e), (e) / gcd(t*e + y, e));
}
return ;
}

FZU 2193 So Hard的更多相关文章

  1. FZU 2193 So Hard (有限小数转换最简分数)(想法题)

    题目链接: 传送门 So Hard Time Limit: 1000MS     Memory Limit: 65536K 题目描述 请将有限小数化为最简分数. 输入 一个整数n 表示需要转化的小数个 ...

  2. FZU 2137 奇异字符串 后缀树组+RMQ

    题目连接:http://acm.fzu.edu.cn/problem.php?pid=2137 题解: 枚举x位置,向左右延伸计算答案 如何计算答案:对字符串建立SA,那么对于想双延伸的长度L,假如有 ...

  3. FZU 1914 单调队列

    题目链接:http://acm.fzu.edu.cn/problem.php?pid=1914 题意: 给出一个数列,如果它的前i(1<=i<=n)项和都是正的,那么这个数列是正的,问这个 ...

  4. ACM: FZU 2105 Digits Count - 位运算的线段树【黑科技福利】

     FZU 2105  Digits Count Time Limit:10000MS     Memory Limit:262144KB     64bit IO Format:%I64d & ...

  5. FZU 2112 并查集、欧拉通路

    原题:http://acm.fzu.edu.cn/problem.php?pid=2112 首先是,票上没有提到的点是不需要去的. 然后我们先考虑这个图有几个连通分量,我们可以用一个并查集来维护,假设 ...

  6. ACM: FZU 2107 Hua Rong Dao - DFS - 暴力

    FZU 2107 Hua Rong Dao Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I6 ...

  7. ACM: FZU 2112 Tickets - 欧拉回路 - 并查集

     FZU 2112 Tickets Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u P ...

  8. ACM: FZU 2102 Solve equation - 手速题

     FZU 2102   Solve equation Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & ...

  9. ACM: FZU 2110 Star - 数学几何 - 水题

     FZU 2110  Star Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u  Pr ...

随机推荐

  1. USACO 4.2 The Perfect Stall(二分图匹配匈牙利算法)

    The Perfect StallHal Burch Farmer John completed his new barn just last week, complete with all the ...

  2. [CSS] 子元素垂直居中的两种方式

    1. 多个子元素水平并排,IE10以下失效 display: flex; align-items: center; justify-content: center; 2.多个子元素竖直排列,这种方式会 ...

  3. CodeForces 718C Sasha and Array

    线段树. 线段树维护区间矩阵和,操作都是最简单的线段树.$lazy$标记不要记录乘了几次,直接记录乘了几次之后的矩阵就可以了,不然每次下传的时候再算一遍时间复杂度会提高. #pragma commen ...

  4. 使用node.js编写脚本将JSON数据转换为SQL语句

    安装依赖模块 当node.js脚本在运行的时候,需要很多支持模块,这些模块存储在node_modules文件夹中.该脚本在执行过程中需要使用到fs.string-format两个支持模块,作用分别是: ...

  5. C# EnumHelper

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Reflection ...

  6. 关于mysql 5.6.24 的my.ini配置问题

  7. iOS 消息推送证书生成方法的简单说明

    openssl x509 -in idp.flowtreasure.cer -inform der -out PushChatCert.pem openssl pkcs12 -nocerts -out ...

  8. 杭电OJ--自行车计速器

    Biker's Trip Odometer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Ot ...

  9. mac xcode 快捷键

    shift + cmd + n     新建项目 cmd + n             新建文件 视图 option + cmd + 回车 打开助理编辑器 cmd + 回车           显示 ...

  10. 6、iOS快速枚举

    今天在写程序的时候想在当前视图跳转的时候释放掉当前视图上面add的一些子视图.因为add的子视图有些是在别的类里面add进来的,当前页面不知道自己当前有哪几个类型的子视图.这样,我就想到了用循环遍历来 ...