暑假经历之ACM培训第七天--做一个简单题目安慰一下

             我的AC率还处于低迷状态。第六天结束时匆匆写完blgo就回去了,是我们这边实验室最后走的。看看时间,11:40。还好没有到第七天。回去吹水了一下,大家就睡着了。终于有累的感觉。今天早上一到实验室,跳闸了,不过我这边的机子没事,可惜不能上网,于是找了两道比较简单的题目做了一下。一个是ugly number,一个移动盒子题。不过第二题由于理解命令错误了,后来就懒得改了。

/*
Ugly numbers are numbers whose only prime factors are 2, 3 or 5.
The sequence   1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, ...
shows the first 11 ugly numbers. By convention, 1 is included.
Write a program to find and print the 1500'th ugly number.
*/

#include "stdio.h"
#include "vector"
#include "algorithm"
using namespace std;

int main()
{
 vector<int> q;
 int count=0,i=0,n,j[3];
 q.push_back(1);
 while(count<=1500){
  for(i=0;i<q.size();i++){
   j[0]=q.at(i)*2;
   if(j[0]>q.back())
    break;
  }
  for(i=0;i<

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值