2019牛客暑期多校训练营(第七场)

B题
niuke

示例1
输入
2
2
1 -2 1
2
1 0 1
输出
No
Yes


就差一点点就打出来了嘤嘤嘤

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;

int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		int n;
		scanf("%d",&n);
		ll a[n+5];
		for(int i = 0 ;  i <= n ; i++) scanf("%d",&a[i+1]);
		if(n == 2) 
		{
			int x = a[2]*a[2]-4*a[1]*a[3];
			if(x >= 0) printf("No\n");
			else printf("Yes\n"); 
			continue;
		}
		else if(n <= 1)
		{ 
			printf("Yes\n");
			continue;
		} 
		else
		{
			printf("No\n");
			continue;
		}
	}
	return 0;
}

#include <bits/stdc++.h>
   
using namespace std;
int main(){
    int T;
    scanf("%d",&T);
    while(T--){
        int n;
        scanf("%d",&n);
        int a[n+5];
        for(int i = 0;i <= n;i++) scanf("%d",&a[i]);
        if((n>2)||(n==2 && a[1]*a[1]-4*a[0]*a[2] >= 0))
            printf("No\n");
        else
            printf("Yes\n"); 
    }
}

最后半个小时卑微签到

J题
牛客

输入
3
12 1
101 9
991 1
输出
22
11
2

题目意思就是让你先把输入的数组倒过来比如1234–>4321,然后再做加法再倒回来输出

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;


ll tr(ll a)
{
	ll da = 0;
	int index = 0;
	while(a != 0)
	{
		da = da*10 + a%10;
		a /= 10;
	}
	return da;
}

int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		ll a,b,aa,bb,ans,res;
		scanf("%lld %lld",&a,&b);
//		aa = tr(a);
//		bb = tr(b);
		ans = tr(a) + tr(b);
		res = tr(ans);
		printf("%lld\n",res);
	}
	return 0;
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值