#include<bits/stdc++.h> using namespace std; #define LL long long #define debug(x) cerr<<#x<<" = "<<x #define sp <<" " #define el <<endl #define fgx cerr<<" ---------------------- "<<endl #define uint unsigned int #define ULL unsigned long long #define DB double #define LDB long double #define pii pair<int,int> #define mpt make_pair #define pb push_back #define fr first #define sc second #define M 1000020//Size #define INF 1000000000 #define INFLL 1000000000000000000 inline int read(){ int nm=0,fh=1; char c=getchar(); for(;!isdigit(c);c=getchar()) if(c=='-') fh=-1; for(;isdigit(c);c=getchar()) nm=nm*10+c-'0'; return nm*fh; } #define mod 1000000007//About inline int add(int x,int y){return (x+y>=mod)?(x+y-mod):(x+y);} inline int mns(int x,int y){return (x-y<0)?(x-y+mod):(x-y);} inline int mul(LL x,LL y){return x*y%mod;} inline void upd(int &x,int y){x=(x+y>=mod)?(x+y-mod):(x+y);} inline void dec(int &x,int y){x=(x-y<0)?(x-y+mod):(x-y);} inline int qpow(int x,LL sq){int res=1;for(;sq;sq>>=1,x=mul(x,x))if(sq&1)res=mul(res,x);return res;} int n,ans=-1; class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param n int整型 节点个数 * @param u int整型vector * @param v int整型vector * @return int整型 */ bool judge(string n) { // write code here LL md=(1ll<<50),now=0ll,T=0ll; bool flag=true; for(int i=0;i<n.size();i++) if(T*10ll+n[i]-'0'>md){ flag=false; break; } else T=T*10ll+n[i]-'0'; if(flag){ for(LL i=0;i<60;i++) if(T==(1ll<<i)-1) return true; return false; } for(int i=0;i<n.size();i++) now=(now*10ll+n[i]-'0')%md; if(now==md-1ll) return true; return false; } }t;
全部评论
(13) 回帖