日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

【HDU2683 TCE-frep number system 完全数+二项展开式】

發布時間:2025/4/16 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【HDU2683 TCE-frep number system 完全数+二项展开式】 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

g(n)是n的因子和
A a b 查詢a b區間有多少個n滿足上式。
Q a 查詢a滿不滿足式子
?

參考

#include <bits/stdc++.h> //#include <iostream> //#include <cstdio> #define X 10005 #define inF 0x3f3f3f3f #define PI 3.141592653589793238462643383 #pragma comment(linker, "/STACK:1024000000,1024000000") using namespace std; typedef long long ll; const int maxn = 1e6+10; const int Times=10; const ll inf= 9223372036854775807;int N=1e6+10; ll primer[maxn],a[maxn]; //int ans[maxn],num[maxn];ll Pow(ll a,ll n){ll ans=1;while(n){if(n&1){ans=ans*a;}a=a*a;n>>=1;}return ans;}bool Prime(ll n){for(int i=2;i<=sqrt(n);++i){if(n%i==0)return false;}return true;} int main() {ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);int cnt=0;for(int i=2;i<60;++i) // i=1會得出 1 可 1 不是完全數{ll ans=Pow(2,i)-1;if(Prime(ans))a[cnt++]=ans*Pow(2,i-1); // (充要條件)歐幾里得完全數公式:如果2p?1是素數,則2p?1?(2p?1)是完全數}// ll a[8]={6,28,496,8128,33550336,8589869056,137438691328LL,2305843008139952128LL};ll x,y,n;char s;while(cin>>s){if(s=='A'){cin>>x>>y;int sum=0;if(x>y)x=x^y^(y=x);for(int i=0;i<cnt;++i){if(x<=a[i]&&a[i]<=y)sum++;}cout<<sum<<endl;}else{cin>>n;int i=0;for(i=0;i<cnt;++i){if(a[i]==n){cout<<1<<endl;break;}}if(i==8)cout<<0<<endl;}} return 0; }

?

總結

以上是生活随笔為你收集整理的【HDU2683 TCE-frep number system 完全数+二项展开式】的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。