穿越了千万个时间线里人海里相依
A做游戏
签到题,贪心就可以
代码语言:javascript复制#include<iostream>
#include<cstdlib>
#include<algorithm>
using namespace std;
typedef long long ll;
ll a,b,c;
ll x,y,z;
int main()
{
cin>>a>>b>>c;
cin>>x>>y>>z;
cout<<(min(a,y) min(b,z) min(c,x))<<endl;
system("pause");
return 0;
}
B排数字
数学问题,关键在于6和1的数量,616161616161,1616161616,这样是616子串出现最多的情形。
代码语言:javascript复制#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<string>
using namespace std;
typedef long long ll;
string s;
ll n;
int main()
{
cin>>n;
cin>>s;
ll num1=0,num2=0;
for(int i=0;i<n; i)
{
if(s[i]=='6') num1 ;
if(s[i]=='1') num2 ;
}
cout<<min(num1-1,num2)<<endl;
s.clear();
system("pause");
return 0;
}
D数三角
暴力求解就行,在这里用到数学中的如何判断一个钝角三角形,我用的是向量
代码语言:javascript复制#include<iostream>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
pair<ll,ll> p[510];
ll n;
int judge(pair<ll,ll> x,pair<ll,ll> y,pair<ll,ll> z)
{
if(((y.first-x.first)*(z.first-x.first) (y.second-x.second)*(z.second-x.second))<0&&((y.second-x.second)*(z.first-x.first)!=(z.second-x.second)*(y.first-x.first)))
return 1;
else
{
return 0;
}
}
int main()
{
cin>>n;
ll num = 0;
for(int i =0;i<n; i)
cin>>p[i].first>>p[i].second;
for(ll i=0;i<n; i)
for(ll j=i 1;j<n; j)
for(ll k =j 1;k<n; k)
{
if(judge(p[i],p[j],p[k])||judge(p[j],p[i],p[k])||judge(p[k],p[i],p[j]))
num ;
}
cout<<num<<endl;
system("pause");
return 0;
}
E做计数
数学问题,将式子两侧平方,就会发现 i*j 一定是平方数,数平方数的个数就行
代码语言:javascript复制#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n;
int main()
{
ll num = 0;
cin>>n;
ll i,j,k;
for( i=1;i<=sqrt(n);i )
{
k = i*i;
for(j =1;j<=sqrt(k); j)
{
if(i==j) num ;
else if(k%j==0) num =2;
}
}
cout<<num<<endl;
system("pause");
return 0;
}
G判正误
板子,快速幂
代码语言:javascript复制#include<iostream>
#include<cstdlib>
#include<algorithm>
using namespace std;
typedef long long ll;
ll a,b,c,d,e,f,g;
ll sum;
const ll mod = 1145141919;
int t;
ll quick(ll a ,ll b)
{
ll res = 1;
//a %=mod;
while(b)
{
if(b&1) res = res * a % mod;
a = a*a%mod;
b>>=1;
}
return res;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>t;
while(t--)
{
cin>>a>>b>>c>>d>>e>>f>>g;
ll sum1 = quick(a,d);
ll sum2 = quick(b,e);
ll sum3 = quick(c,f);
sum = (sum1 sum2 sum3);//%mod;
if(sum == g)
cout<<"Yes"<<endl;//puts("Yes");
else
{
cout<<"No"<<endl;//puts("No");
}
}
system("pause");
return 0;
}