开始编程之旅

刚刚学了一点C++,觉得挺有趣的,第一次写博客,不知道写什么,所以贴了一道我做的水题:

uva 136 Ugly Number:

原来以为简单的模拟暴力一下就解决了,可惜超时了,无奈之下,只好打表:

下面是code :

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
using namespace std;

int main()
{

printf("The 1500'th ugly number is 859963392.\n");


return 0;
}
/*
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
using namespace std;
int count=1;
int main()
{
int i=1;
while(count<1500)
{
int t=++i;
if (t%10==5||t%10==0)
while(t%5==0)
t/=5;
while(t%3==0)
t/=3;
while(t%2==0)
t/=2;
if (t==1)
count++;
}
printf("<%d>\n",i);


return 0;
}*/

 

请大神们多多指教。

转载于:https://www.cnblogs.com/godding/p/3629037.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值