7177-Link with Equilateral Triangle
不存在满足题意的三角形,输出no即可
#include <bits/stdc++.h>
using namespace std;
#define js ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define debug system("pause")
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
void solve(){
int n;cin>>n;
cout<<"No\n";
}
int main(){
js;
int T;cin>>T;
while(T--) solve();
debug;
}
7179-BIT Subwaya
ans1计算
ans2按照题意累加即可
#include <bits/stdc++.h>
using namespace std;
#define js ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define debug system("pause")
#define ll long long
#define endl "\n"
#define show(x) cout<<#x<<"="<<x<<endl
const int N = 1e5+5;
int v[N];
double ans1,ans2,s;
void solve(){
int n;cin>>n;
ans2=0;s=0;
for(int i=1;i<=n;i++) {
cin >> v[i];
s += v[i];
if(ans2<100) {
ans2 += v[i];
}
else if(ans2<200) {
ans2 += 0.8*v[i];
}
else{
ans2 += 0.5*v[i];
}
}
if(s<=100) {
ans1=s;
}
else if(s<=225) {
ans1=100+(s-100)*0.8;
}
else {
ans1=200+(s-225)*0.5;
}
cout<<fixed<<setprecision(3)
<<ans1<<" "<<ans2<<endl;
}
int main(){
js;
int T;cin>>T;
while(T--) solve();
debug;
}
7184-Link is as bear
求数组n的最大亦或和,套用线性基模板即可
#include<bits/stdc++.h>
using namespace std;
#define js ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define debug system("pause")
#define ll long long
#define endl "\n"
//线性基模板
struct L_B
{
const static int BASE = 63;
long long d[BASE], p[BASE];
int cnt, flag;
void init()
{
memset(d, 0, sizeof(d));
memset(p, 0, sizeof(p));
cnt = 0;
flag = 0;
} // 1e18以内的数都适用.
inline bool insert(long long val)
{
for (int i=BASE- 1; i >= 0; i--)
{
if (val & (1ll << i))
{
if (!d[i])
{
d[i] = val;
return true;
}
val ^= d[i];
}
}
flag = 1; //可以异或出0
return false;
// 可判断val是否存在于线性基当中.
}
long long query_max()
{
long long res = 0;
for (int i = BASE - 1; i >= 0; i--)
{
if ((res ^ d[i]) > res)
res ^= d[i];
}
return res;
}
long long query_min()
{ // 应该预先判断能否是0的情况..QAQ
if (flag)
return 0;
for (int i = 0; i <= BASE - 1; i++)
{
if (d[i])
return d[i];
}
}
void rebuild()
{ // 用于求第k小值.需要先进行独立预处理
for (int i = BASE - 1; i >= 0; i--)
{
for (int j = i - 1; j >= 0; j--)
{
if (d[i] & (1ll << j))
d[i] ^= d[j];
}
}
for (int i = 0; i <= BASE - 1; i++)
{
if (d[i])
p[cnt++] = d[i];
}
}
long long kthquery(long long k)
{ // 注意判断原序列异或出0的情况, 此时应该将k -- 在进行后面的操作.
if (flag) //判0
--k;
if (!k)
return 0;
long long res = 0;
if (k >= (1ll << cnt))
return -1;
for (int i = BASE - 1; i >= 0; i--)
{
if (k & (1LL << i))
res ^= p[i];
}
return res;
}
void Merge(const L_B &b)
{ // 把b这个线性基插入到当前这个线性基中.
for (int i = BASE - 1; i >= 0; i--)
if (b.d[i])
insert(b.d[i]);
}
} LB;
void solve(){
L_B l;
l.init();
int n;cin>>n;
for(int i=0;i<n;i++){
ll x;cin>>x;
l.insert(x);
}
cout<<l.query_max()<<endl;
}
int main(){
js;
int T;cin>>T;
while(T--) solve();
debug;
}