好題
數學題—感覺優化時間複雜度的方式值得學一下
這裡三分的區間r應該=min(1000000ll,x),當初寫的x。。。wa傻了。
還有真的卡常,oulasai(31622)最穩妥
#pragma gcc optimize(3,"ofast","inline")
//g++
#include
#define test freopen("c:\\users\\hp\\desktop\\acm\\in.txt","r",stdin);
#define mem(a,x) memset(a,x,sizeof(a))
#define debug(x) cout << #x << ": " << x << endl;
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fcout cout
namespace std;
typedef
long
long ll;
typedef pair pi;
const ll inf=
0x3f3f3f3f
;const ll inf=
0x7fffffffffffffff
;const ll mod=
1e9+7;
const ll maxn =
1e6+5;
const
double eps=
1e-8
;template
<
typename t>
void
read
(t &x)
while
(isdigit
(ch))x*
=f;}
template
<
typename t,
typename..
. args>
void
read
(t &first, args&..
. args)
ll sgn
(double a)
//inline ll add(ll x,ll y)
inline ll sub
(ll x,ll y)
inline ll mul
(ll x,ll y)
inline ll sq
(ll x)
ll pow
(ll a,ll b)
bool vis[maxn]
;ll prime[maxn]
,pos,a[maxn]
;void
oulasai
(ll n)
//尤拉篩}}
ll check
(ll x)
else
if(mid * mid * mid< x)
else
}return1;
}void
solve()
while
(n%prime[i]==0
)}ans*
=check
(n);
cout<
"\n";}
main()
2020牛客寒假演算法基礎集訓營
長期更新,補完為止 2 g 判正誤 題意 t組資料。判斷a d b e c f是否等於g。1e9 a,b,c,g 1e9,0 d,e,f 1e9。保證不會出現指數和底數同為 0 的情況。思路 硬算會tle或mle。快速冪取模,為了增加過題概率,多取幾個模數判斷。includeusing namesp...
2020牛客寒假演算法基礎集訓營1
找規律,推公式 三角形個數為2 m n m n m 1 n 1 2 m n mn m 1 n 1 2 m n mn m 1 n 1 include include include include using namespace std typedef long long ll const int m...
2020牛客寒假演算法基礎集訓營1
h題 突然發現h題可以用好多種方法做的。方法一 雙指標,維護乙個修改次數小於等於k的區間 include using namespace std typedef long long ll const int mod 1e9 7 const int n 1e5 5 const int inf 0x3f...