1. 程式人生 > >51nod 1717 好數 (水題)

51nod 1717 好數 (水題)

n) 技術分享 iostream image def 復雜 cout std algorithm

題目:

技術分享圖片

看起來很復雜,其實就是有多少個素因子就翻轉多少次。

然後考慮到只有平方數有奇數個素因子。

一次過,上代碼把:

#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 好數 (水題)