竞码编程-蓝桥杯模拟赛3(大学生组&青少年组)

A. 试题A:生存还是毁灭,这是一个问题 7’ 描述

#include <stdio.h>

int main()

{

    printf("141");

    return 0;

}

B. 试题B:小小神枪手 开局98K 8' 描述

#include <bits/stdc++.h>
using namespace std;
int main() 
{
    printf("1.305323")
}

C. 试题C:关云长单刀会金莲,贾宝玉三打白骨精 10’

破题:插板法,将连续的4天学习《水浒传》,连续的3天看《西游记》,连续的5天看《三国演义》,连续的3天看《红楼梦》分别看做一天,那么,最后就是A(20,4)

#include <stdio.h>
int main() 
{
  printf("%d\n", 20 * 19 * 18 * 17);
  return 0;
}

D. 试题D:抽刀断水水更流,举杯销愁愁更愁 10’

破题:随机选出0-12个数,使其和在0-1694之间,二进制进行计算并储存,然后去重一下

#include <bits/stdc++.h>
using namespace std;
int main() 
{
  printf("215\n");
}

E. 试题E:左手作圆右手方,世人机敏便可尔 15'

破题:画图推一下公式

#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
const double pi = 3.1415926538979;
using namespace std;

int main()
{
    double ang = acos(3.0/4);
    double ans = pi*4-4*(ang*4-cos(ang)*sin(ang)*4) ;
    printf("%.2lf",ans);
}

F. 试题F:等差等比有联系 公差公比求通项 15’ 描述

WA点:是任意两项,不是相邻两项,那么,就要先找到他们的公因子,再快速幂

#include <bits/stdc++.h>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <algorithm>
using namespace std;
#include <string>
#include <cstdio>
#define TLE std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
typedef pair<int,int> pii;
const ll mod = 1000000000 ;
const int INF=0x3f3f3f3f;
using namespace std;
const int mxn = 1e4+7 ;
ll t,n,m,k,l,r,prime[mxn],isprime[mxn],phi[mxn];
const double pi = 3.1415926538979;
ll a,b,c,d;
ll ksm(ll x,ll n)
{
    ll ans=1;
    while (n)
    {
        if (n&1)
           ans=(ans*x)%mod;
        x=x*x%mod;
        n>>=1;
    }
    return ans;
}
bool check(ll a,ll b) {while(a%b==0) a/=b ; return a==1 ;}
int main()
{
    cin>>a>>b>>c>>n;
    ll q1 = b/a , q2 = c/b ;
    for(ll i=min(q1,q2);i>=2;i--)
        if(check(q1,i)&&check(q2,i))
        {
            cout<<a*ksm(i,n-1)%mod<<endl;
            return 0 ;
        }
    cout<<a%mod<<endl;
    return 0 ;
}

G. 试题G:进退得失全看透,名利当作粪土丢 15‘

破题:贪心

H. 试题H:映日圆光万颗余,如观宝藏隔虾须 20'

破题:DFS/BFS,最后遍历 | 最外圈,最后是true就先走,反之后走

J. 试题J:世界末日的时候,我会牵着你的手 25‘

发布了102 篇原创文章 · 获赞 30 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/m0_43382549/article/details/104578229