码迷,mamicode.com
首页 > 其他好文 > 详细

51nod 1717 好数 (水题)

时间:2017-11-28 01:35:35      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:cin   bsp   images   分享图片   map   idt   src   奇数   技术   

题目:

技术分享图片

 

 

 

 

看起来很复杂,其实就是有多少个素因子就翻转多少次。

然后考虑到只有平方数有奇数个素因子。

 

一次过,上代码把:

#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <math.h>
#include <queue>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
typedef long long ll;
#define INF 2147483647


int main(){
    ll n;
    cin >> n;
    ll p = sqrt(n);
    cout << n-p << endl;
    return 0;
}

 

51nod 1717 好数 (水题)

标签:cin   bsp   images   分享图片   map   idt   src   奇数   技术   

原文地址:http://www.cnblogs.com/zhangjiuding/p/7906579.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!