题目链接https://ac.nowcoder.com/acm/contest/881/A(单调栈)

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<map>
#include<cmath>
const int maxn=1e5+;
typedef long long ll;
using namespace std;
int L1[*maxn],L2[*maxn];
int a[*maxn],b[*maxn];
int main()
{
int n;
while(~scanf("%d",&n))
{
for(int t=;t<=n;t++)
{
scanf("%d",&a[t]);
}
for(int t=;t<=n;t++)
{
scanf("%d",&b[t]);
}
stack<int>s1,s2;
for(int t=;t<=n;t++)
{
if(s1.empty())
{
L1[t]=;
s1.push(t);
continue;
}
else
{
while(!s1.empty()&&a[s1.top()]>a[t])
{
s1.pop();
}
if(s1.empty())
{
L1[t]=;
s1.push(t);
continue;
}
else
{
L1[t]=s1.top();
s1.push(t);
continue;
}
}
}
for(int t=;t<=n;t++)
{
if(s2.empty())
{
L2[t]=;
s2.push(t);
continue;
}
else
{
while(!s2.empty()&&b[s2.top()]>b[t])
{
s2.pop();
}
if(s2.empty())
{
L2[t]=;
s2.push(t);
continue;
}
else
{
L2[t]=s2.top();
s2.push(t);
continue;
}
}
}
int k=n+;
for(int t=;t<=n;t++)
{
//cout<<L1[k]<<" "<<L2[k]<<endl;
if(L1[t]!=L2[t]){
k=t;
break;
}
}
printf("%d\n",k-); }
return ;
}

题目链接:https://ac.nowcoder.com/acm/contest/881/F(思维)

三角形面积的22倍

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<map>
#include<cmath>
const int maxn=1e5+;
typedef long long ll;
using namespace std;
int main()
{ long double x0,y0,x1,y1,x2,y2;
long double a,b,c,p,S;
long double ans;
while(cin>>x0>>y0>>x1>>y1>>x2>>y2)
{
a=sqrtl((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1));
b=sqrtl((x0-x2)*(x0-x2)+(y0-y2)*(y0-y2));
c=sqrtl((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
//cout<<a<<" "<<b<<" "<<c<<endl;
p=(a+b+c)/;
S=sqrtl(p*(p-a)*(p-b)*(p-c));
S=S*;
ans=S;
printf("%.0Lf\n",ans);
} return ;
}

海伦公式版没过 不知道原因

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<map>
#include<cmath>
const int maxn=1e5+;
typedef long long ll;
using namespace std;
int main()
{ long double x0,y0,x1,y1,x2,y2;
long double a,b,c,p,S;
long double ans;
while(cin>>x0>>y0>>x1>>y1>>x2>>y2)
{
a=sqrtl((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1));
b=sqrtl((x0-x2)*(x0-x2)+(y0-y2)*(y0-y2));
c=sqrtl((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
//cout<<a<<" "<<b<<" "<<c<<endl;
p=(a+b+c)/;
S=sqrtl(p*(p-a)*(p-b)*(p-c));
S=S*;
ans=S;
printf("%.0Lf\n",ans);
} return ;
}

题目链接:https://ac.nowcoder.com/acm/contest/881/J(大数)

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
using namespace std; const int maxn = ; struct bign{
int d[maxn], len; void clean() { while(len > && !d[len-]) len--; } bign() { memset(d, , sizeof(d)); len = ; }
bign(int num) { *this = num; }
bign(char* num) { *this = num; }
bign operator = (const char* num){
memset(d, , sizeof(d)); len = strlen(num);
for(int i = ; i < len; i++) d[i] = num[len--i] - '';
clean();
return *this;
}
bign operator = (int num){
char s[]; sprintf(s, "%d", num);
*this = s;
return *this;
} bign operator + (const bign& b){
bign c = *this; int i;
for (i = ; i < b.len; i++){
c.d[i] += b.d[i];
if (c.d[i] > ) c.d[i]%=, c.d[i+]++;
}
while (c.d[i] > ) c.d[i++]%=, c.d[i]++;
c.len = max(len, b.len);
if (c.d[i] && c.len <= i) c.len = i+;
return c;
}
bign operator - (const bign& b){
bign c = *this; int i;
for (i = ; i < b.len; i++){
c.d[i] -= b.d[i];
if (c.d[i] < ) c.d[i]+=, c.d[i+]--;
}
while (c.d[i] < ) c.d[i++]+=, c.d[i]--;
c.clean();
return c;
}
bign operator * (const bign& b)const{
int i, j; bign c; c.len = len + b.len;
for(j = ; j < b.len; j++) for(i = ; i < len; i++)
c.d[i+j] += d[i] * b.d[j];
for(i = ; i < c.len-; i++)
c.d[i+] += c.d[i]/, c.d[i] %= ;
c.clean();
return c;
}
bign operator / (const bign& b){
int i, j;
bign c = *this, a = ;
for (i = len - ; i >= ; i--)
{
a = a* + d[i];
for (j = ; j < ; j++) if (a < b*(j+)) break;
c.d[i] = j;
a = a - b*j;
}
c.clean();
return c;
}
bign operator % (const bign& b){
int i, j;
bign a = ;
for (i = len - ; i >= ; i--)
{
a = a* + d[i];
for (j = ; j < ; j++) if (a < b*(j+)) break;
a = a - b*j;
}
return a;
}
bign operator += (const bign& b){
*this = *this + b;
return *this;
} bool operator <(const bign& b) const{
if(len != b.len) return len < b.len;
for(int i = len-; i >= ; i--)
if(d[i] != b.d[i]) return d[i] < b.d[i];
return false;
}
bool operator >(const bign& b) const{return b < *this;}
bool operator<=(const bign& b) const{return !(b < *this);}
bool operator>=(const bign& b) const{return !(*this < b);}
bool operator!=(const bign& b) const{return b < *this || *this < b;}
bool operator==(const bign& b) const{return !(b < *this) && !(b > *this);} string str() const{
char s[maxn]={};
for(int i = ; i < len; i++) s[len--i] = d[i]+'';
return s;
}
}; istream& operator >> (istream& in, bign& x)
{
string s;
in >> s;
x = s.c_str();
return in;
} ostream& operator << (ostream& out, const bign& x)
{
out << x.str();
return out;
}
int main()
{
bign x,y,a,b;
while(cin>>x>>a>>y>>b)
{
if(x*b==y*a)
{
puts("=");
}
else if(x*b<y*a)
{
puts("<");
}
else
{
puts(">");
}
}
}

牛客多校训练AFJ(签到)的更多相关文章

  1. 牛客多校训练第八场G.Gemstones(栈模拟)

    题目传送门 题意: 输入一段字符串,字符串中连续的三个相同的字符可以消去,消去后剩下的左右两段字符串拼接,求最多可消去次数. 输入:ATCCCTTG   输出:2 ATCCCTTG(消去CCC)——& ...

  2. 牛客多校训练第八场C.CDMA(思维+构造)

    题目传送门 题意: 输入整数m( m∈2k ∣ k=1,2,⋯,10),构造一个由1和-1组成的m×m矩阵,要求对于任意两个不同的行的内积为0. 题解: Code: #include<bits/ ...

  3. 2019牛客多校训练第四场K.number(思维)

    题目传送门 题意: 输入一个只包含数字的字符串,求出是300的倍数的子串的个数(不同位置的0.00.000等都算,并考虑前导零的情况). sample input: 600 1230003210132 ...

  4. 2019牛客多校训练第三场H.Magic Line(思维)

    题目传送门 大致题意: 输入测试用例个数T,输入点的个数n(n为偶数),再分别输入n个不同的点的坐标,要求输出四个整数x1,y1,x2,y2,表示有一条经过点(x1,y1),(x2,y2)的直线将该二 ...

  5. 2019牛客多校训练第三场B.Crazy Binary String(思维+前缀和)

    题目传送门 大致题意: 输入整数n(1<=n<=100000),再输入由n个0或1组成的字符串,求该字符串中满足1和0个数相等的最长子串.子序列. sample input: 801001 ...

  6. 18牛客多校训练第二场 J farm

    题意:一个n×m的农田, 每个小格子都有一种作物, 现在喷t次农药,每次农药覆盖一个矩形, 该矩形里面与农药类型不同的植物都会死掉, 求最后植物的死亡数是多少. 题解:二维树状数组. 每次喷农药的时候 ...

  7. 2019暑假牛客多校训练-第八场-C-CDMA(递归、水题)

    观察前3组可以推出递归规律,生成下一个类型时,每行copy自身与自身相反. 题目描述 Gromah and LZR have entered the third level. There is a b ...

  8. 2019牛客多校第一场 I Points Division(动态规划+线段树)

    2019牛客多校第一场 I Points Division(动态规划+线段树) 传送门:https://ac.nowcoder.com/acm/contest/881/I 题意: 给你n个点,每个点有 ...

  9. 牛客多校第一场 B Inergratiion

    牛客多校第一场 B Inergratiion 传送门:https://ac.nowcoder.com/acm/contest/881/B 题意: 给你一个 [求值为多少 题解: 根据线代的知识 我们可 ...

随机推荐

  1. 虚拟机安装Centos(VirtulBox)

    阿里云服务器本月底到期了,之前自己犹豫不觉没上279元3年服务器的车,但是又要用linux,所以有了这篇文章. VirtulBox 一款开源的虚拟化主机应用,可以实现一台电脑上运行多个操作系统(Lin ...

  2. time模块 random模块

    time模块 time.sys等模块是C语言实现的,内置到了python解释器的.而不是py文件. 导入模块的时候,优先到python解释器,然后才会找py文件. #时间戳 #计算 # print(t ...

  3. Kaggle-pandas(4)

    Grouping-and-sorting 教程 映射使我们可以一次将整个列中的数据转换为DataFrame或Series中的一个值. 但是,通常我们希望对数据进行分组,然后对数据所在的组进行特定的操作 ...

  4. Android menu菜单的深入了解。。。

    今天补充刚开始的菜单控件,这是基于: https://www.cnblogs.com/aolong/p/12868015.html 里面的菜单写的. 今天学的后面部分是结合昨天的Fragment一起的 ...

  5. 一文打尽Java抽象类和接口的相关问题

    相关文章: <面向对象再探究>:介绍了面向对象的基本概念 <详解Java的对象创建>:介绍了对象的创建.构造器的使用 <一文打尽Java继承的相关问题>:介绍了继承 ...

  6. 注重代码习惯,Python零基础从这本书籍开始!

    笨办法学 Python是Zed Shaw 编写的一本Python入门书籍.适合对计算机了解不多,没有学过编程,但对编程感兴趣的朋友学习使用.这本书以习题的方式引导读者一步一步学习编 程,从简单的打印一 ...

  7. Java基础—面向对象特性

    1.三大特性 ①.封装 所谓封装,就是将客观事物封装成抽象的类,类的数据和方法只允许可信的类或者对象操作,对不可信的类或对象进行信息隐藏.封装是面向对象的特征之一,是对象和类概念的主要特性.简单的说, ...

  8. gtk.Builder.AddFromFile SIGSEGV.

    可能是由于GTK没有初始化的缘故,在程序开头加上gtk.Init(nil)进行初始化 或者参考我这篇博客就不会出错了

  9. K8S(11)配置中心实战-单环境交付apollo三组件

    k8s配置中心实战-交付apollo三组件 目录 k8s配置中心实战-交付apollo三组件 1 apollo简单说明 1.1 apollo最简架构图: 1.2 apollo组件部署关系 2 为app ...

  10. 解决SpringBoot页面跳转无法访问静态资源的问题

    初学SpringBoot,写项目的时候遇到了问题,原本的页面是这样的 但启动项目后是这样的 这是因为thymeleaf中引入静态资源及模板需要使用到 th:xxx 属性,否则无法在动态资源中访问静态资 ...