博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
牛客多校训练AFJ(签到)
阅读量:4327 次
发布时间:2019-06-06

本文共 4889 字,大约阅读时间需要 16 分钟。

题目链接(单调栈)

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
const int maxn=1e5+5;typedef long long ll;using namespace std;int L1[5*maxn],L2[5*maxn];int a[5*maxn],b[5*maxn];int main(){ int n; while(~scanf("%d",&n)) { for(int t=1;t<=n;t++) { scanf("%d",&a[t]); } for(int t=1;t<=n;t++) { scanf("%d",&b[t]); } stack
s1,s2; for(int t=1;t<=n;t++) { if(s1.empty()) { L1[t]=0; s1.push(t); continue; } else { while(!s1.empty()&&a[s1.top()]>a[t]) { s1.pop(); } if(s1.empty()) { L1[t]=0; s1.push(t); continue; } else { L1[t]=s1.top(); s1.push(t); continue; } } } for(int t=1;t<=n;t++) { if(s2.empty()) { L2[t]=0; s2.push(t); continue; } else { while(!s2.empty()&&b[s2.top()]>b[t]) { s2.pop(); } if(s2.empty()) { L2[t]=0; s2.push(t); continue; } else { L2[t]=s2.top(); s2.push(t); continue; } } } int k=n+1; for(int t=1;t<=n;t++) { //cout<
<<" "<
<

题目链接:(思维)

三角形面积的22倍

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
const int maxn=1e5+5;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<
<<" "<<<" "<
<

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

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
const int maxn=1e5+5;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<
<<" "<<<" "<
<

题目链接:(大数)

#include 
#include
#include
#include
#include
#include
using namespace std; const int maxn = 1000; struct bign{ int d[maxn], len; void clean() { while(len > 1 && !d[len-1]) len--; } bign() { memset(d, 0, sizeof(d)); len = 1; } bign(int num) { *this = num; } bign(char* num) { *this = num; } bign operator = (const char* num){ memset(d, 0, sizeof(d)); len = strlen(num); for(int i = 0; i < len; i++) d[i] = num[len-1-i] - '0'; clean(); return *this; } bign operator = (int num){ char s[20]; sprintf(s, "%d", num); *this = s; return *this; } bign operator + (const bign& b){ bign c = *this; int i; for (i = 0; i < b.len; i++){ c.d[i] += b.d[i]; if (c.d[i] > 9) c.d[i]%=10, c.d[i+1]++; } while (c.d[i] > 9) c.d[i++]%=10, c.d[i]++; c.len = max(len, b.len); if (c.d[i] && c.len <= i) c.len = i+1; return c; } bign operator - (const bign& b){ bign c = *this; int i; for (i = 0; i < b.len; i++){ c.d[i] -= b.d[i]; if (c.d[i] < 0) c.d[i]+=10, c.d[i+1]--; } while (c.d[i] < 0) c.d[i++]+=10, 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 = 0; j < b.len; j++) for(i = 0; i < len; i++) c.d[i+j] += d[i] * b.d[j]; for(i = 0; i < c.len-1; i++) c.d[i+1] += c.d[i]/10, c.d[i] %= 10; c.clean(); return c; } bign operator / (const bign& b){ int i, j; bign c = *this, a = 0; for (i = len - 1; i >= 0; i--) { a = a*10 + d[i]; for (j = 0; j < 10; j++) if (a < b*(j+1)) break; c.d[i] = j; a = a - b*j; } c.clean(); return c; } bign operator % (const bign& b){ int i, j; bign a = 0; for (i = len - 1; i >= 0; i--) { a = a*10 + d[i]; for (j = 0; j < 10; j++) if (a < b*(j+1)) 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-1; i >= 0; 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 = 0; i < len; i++) s[len-1-i] = d[i]+'0'; 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
"); } }}

 

转载于:https://www.cnblogs.com/Staceyacm/p/11210802.html

你可能感兴趣的文章
阶段3 2.Spring_03.Spring的 IOC 和 DI_2 spring中的Ioc前期准备
查看>>
阶段3 2.Spring_03.Spring的 IOC 和 DI_4 ApplicationContext的三个实现类
查看>>
阶段3 2.Spring_02.程序间耦合_8 工厂模式解耦的升级版
查看>>
阶段3 2.Spring_03.Spring的 IOC 和 DI_6 spring中bean的细节之三种创建Bean对象的方式
查看>>
阶段3 2.Spring_04.Spring的常用注解_3 用于创建的Component注解
查看>>
阶段3 2.Spring_04.Spring的常用注解_2 常用IOC注解按照作用分类
查看>>
阶段3 2.Spring_09.JdbcTemplate的基本使用_5 JdbcTemplate在spring的ioc中使用
查看>>
阶段3 3.SpringMVC·_07.SSM整合案例_02.ssm整合之搭建环境
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第1节零基础快速入门SpringBoot2.0_3、快速创建SpringBoot应用之手工创建web应用...
查看>>
阶段3 3.SpringMVC·_07.SSM整合案例_04.ssm整合之编写SpringMVC框架
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第1节零基础快速入门SpringBoot2.0_5、SpringBoot2.x的依赖默认Maven版本...
查看>>
阶段3 3.SpringMVC·_07.SSM整合案例_08.ssm整合之Spring整合MyBatis框架
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第2节 SpringBoot接口Http协议开发实战_9、SpringBoot基础HTTP其他提交方法请求实战...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第2节 SpringBoot接口Http协议开发实战_12、SpringBoot2.x文件上传实战...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第4节 Springboot2.0单元测试进阶实战和自定义异常处理_19、SpringBoot个性化启动banner设置debug日志...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第4节 Springboot2.0单元测试进阶实战和自定义异常处理_20、SpringBoot2.x配置全局异常实战...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第5节 SpringBoot部署war项目到tomcat9和启动原理讲解_23、SpringBoot2.x启动原理概述...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第4节 Springboot2.0单元测试进阶实战和自定义异常处理_21、SpringBoot2.x配置全局异常返回自定义页面...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第8节 数据库操作之整合Mybaties和事务讲解_32..SpringBoot2.x持久化数据方式介绍...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第8节 数据库操作之整合Mybaties和事务讲解_34、SpringBoot整合Mybatis实操和打印SQL语句...
查看>>