51nod 1717 好数 (水题)

题目:

 

 

 

 

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

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

 

一次过,上代码把:

#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;
}

 

posted @ 2017-11-27 22:50  ninding  阅读(149)  评论(0编辑  收藏  举报