牛客小白月赛1

A-简单题
还好我上学期学过,经过发现Θ是等于e的,所以问题就变得简单了。不多说,上代码。

#include<iostream>
#include<cstdio>
#include<math.h>
#include<algorithm>
#define PI 3.141592654
#define e 2.71828182845904523536
using namespace std;
typedef long long ll;
const int N = 1e3+2;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b;
        int c;
        cin>>a>>b>>c;
        double ans =1;
        ans = pow(e,a);
        printf("%.*f\n",c,ans*b);//可能有人不会输出这个格式,这里的*就对应着c,控制场宽
    }
    return 0;
}

B-简单题2
同样。。。知道 lnΥ = 1 ,也就意味着Υ等于自然常数 e,所以最后 Ξ 的值就等于 (δ^e)/ Φ。

#include<iostream>
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<cstring>
#include<queue>
#include<map>
#include<deque>
#include<vector>
#define PI 3.141592654
#define e 2.71828182845904523536
using namespace std;
typedef long long ll;
const int N = 1e3+2;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b;
        int c;
        cin>>a>>b>>c;
        double ans =1;
        ans = pow(a,e);
        ans = ans/b;
        printf("%.*f\n",c,ans);
    }
    return 0;
}

C-分元宵
经过组合可以知道最后一共有,ϖxϱ 个碗和 ςxϑ种元宵,所以最后问多少种装元宵的方式,我想可以快速幂水之了。(ςxϑ)^( ϖxϱ),当然记得要mod e。

#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
const int N = 2e5+3;
typedef long long ll;
ll a,b,c,d,e;
ll pow1(ll x,ll n)
{
    ll ans = 1;
    ll res = x%e;
    while(n){
        if(n&1)
            ans = ((ans%e)*(res%e)%e);
        res = ((res*res)%e);
        n >>= 1;
    }
    return ans;
}

int main()
{
    // freopen("in.txt","r",stdin);
    cin>>a>>b>>c>>d>>e;
    ll ans;
    ans = pow1(((a%e)*(b%e)),(c*d))%e;
    cout<<ans<<endl;
    return 0;
}

D-多项式乘法
fft的话,蒟蒻lz还不会QAQ。还好这题的数据可以暴力模拟多项式乘法。

#include<algorithm>
#include<iostream>
#include<stdio.h>
using namespace std;
const int N = 1e5+3;
const int inf = 0x3f3f3f;
int a[N],b[N],c[N];

int main()
{
    int m,n;
    cin>>n>>m;
    for(int i = 0; i <= n; i++)
    cin>>a[i];
    for(int i = 0; i <= m; i++)
    cin>>b[i];
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= m; j++){
            c[i+j] += a[i]*b[j];
        }
    }
    for(int i = 0; i < m+n+1; i++)
    //if(c[i]!=0)//这是个坑点QwQ
    printf("%d%c",c[i],(i==(m+n))?'\n':' ');
    return 0;
}

E-圆与三角形
艺高人胆大,敢于蒙r+1绝对是真正的勇士。
经过一系列证明可以发现这里写图片描述
sinA*r前面的一大堆是恒等于1的,又因为sinA最大值为1,所以答案为1+r。(ε=(´ο`*)))唉,估计泥萌也懒得找度娘,这里就给上出题人给的证明好唠)这里写图片描述

#include <algorithm>
#include <iostream>
using namespace std;

int main()
{
    // freopen("in.txt","r",stdin);
    double r;
    cin>>r;
    printf("%.2f",r+1);
    return 0;
}

F-三视图
待补。

G-あなたの蛙は旅⽴っています
数字三角形升级版,难点估计就在处理数据上了吧,将六边形稍微转一个角度,发现可以压缩成一个四边形。待补(就算别的都不补,这个也一定会补的!QAQ,认真脸.jpg)

H-写真がとどいています
一道模拟题,而且题里说照着翻译嘛23333,lz因为对五线谱毫无所知,就木有做!!QAQ

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5; 
char a[10] = {' ', 'F', 'E', 'D', 'C', 'B', 'A', 'G', 'F', 'E'};
char ans[N];
char s[10][N];

int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= 9; ++i) {
        scanf("%s", s[i] + 1);
        for (int j = 1; j <= n; ++j) {
            if (s[i][j] == '|') 
                ans[j] = '|';
            else if(s[i][j] == 'o') 
                ans[j] = a[i];
        }
    }
    for (int i = 1; i <= n; ++i) {
        cout<<ans[i];
    }
    cout<<endl;
    return 0;
}

I-あなたの蛙が帰っています
卡特兰数h(n)-h(n-1),待补。(这个等这周六日也一定会补的!)

J-おみやげをまらいました
就是模拟石头剪刀布嘛,每次和三个字符串比较一下,然后记得fake的情况。
(lz用java写的,这个懂大体思路才是最重要的嘛233333)

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        String [][] pan = new String[3][2];
        //读入情况
        for(int i = 0; i < pan.length; i++){
            for(int j = 0; j < pan[i].length; j++){
                pan[i][j] = in.next();
            }
        }
        int t = in.nextInt();
        for(int i = 0; i < t; i++){
            String s = in.next();
            int flag = 1;
            for(int j = 0; j < pan.length; j++){
                if(s.equals(pan[j][1])){  //如果和某个字符串相等,那么输出可以赢它的
                    System.out.println(pan[j][0]);
                    flag = 0;
                }
            }
            if(flag==1){ //fake的情况(如果和每个字符串都匹配不上就说明非法咯)
                System.out.println("Fake");
            }
        }
        in.close();
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值