nyoj330
来源:互联网 发布:广州网络推广哪家好 编辑:程序博客网 时间:2024/05/16 17:44
#include <stdio.h>
#include <string.h>
int str[100010];
int main()
{
int n, num, i, temp;
scanf("%d", &n);
while(n--)
{
scanf("%d", &num);
/*for(i = 0; i < 1000100; i++)
str[i] = 0;*/
memset(str, 0, sizeof(str));//用这个比用上面的节省时间
temp = 1;
if(num == 1 || num == -1)
{
printf("%d\n", num);
continue;
}
else if(num < 0)
{
printf("-0.");
num = -num;
}
else
{
printf("0.");
}
while(str[temp] == 0 && temp != 0)
{
str[temp] = 1;
temp *= 10;
printf("%d", temp / num);
temp %= num;
}
printf("\n");
}
return 0;
}
#include <string.h>
int str[100010];
int main()
{
int n, num, i, temp;
scanf("%d", &n);
while(n--)
{
scanf("%d", &num);
/*for(i = 0; i < 1000100; i++)
str[i] = 0;*/
memset(str, 0, sizeof(str));//用这个比用上面的节省时间
temp = 1;
if(num == 1 || num == -1)
{
printf("%d\n", num);
continue;
}
else if(num < 0)
{
printf("-0.");
num = -num;
}
else
{
printf("0.");
}
while(str[temp] == 0 && temp != 0)
{
str[temp] = 1;
temp *= 10;
printf("%d", temp / num);
temp %= num;
}
printf("\n");
}
return 0;
}
0 0
- nyoj330
- C++ 虚函数表解析
- 联想教育应用使用说明(7.6版本)——第4章 网络控制工具的使用
- linux下更改共享内存的最大值
- 【Database】常用数据库Oracle/MySQL/MS SQL Server 驱动包下载地址
- 20141005 【 DP 】 UVa 1289 Stacking Plates
- nyoj330
- poj 1659 Frogs' Neighborhood (判断简单图并输出)
- leetcode Sqrt(x)
- IP TCP UDP
- 格式化字符串
- SGU 210 Acdream 1227 Beloved Sons KM
- 开源GUI-Microwindows之程序入口分析
- 在命令行中运行eclipse中创建的java项目
- 八数码问题,初始局面和目标局面最少移动步数