头像

LAS

国际coding组织




在线 


最近来访(13)
用户头像
Fatin
用户头像
acwing_090
用户头像
宇航兔
用户头像
wo怎么什么都不会
用户头像
南岸以南南岸哀
用户头像
大雪球hh
用户头像
acwing_74240
用户头像
辣鸡号航母
用户头像
每日抑题做亿天
用户头像
爱吃干煸鱼的大布丁
用户头像
lijiale

活动打卡代码 AcWing 128. 编辑器

LAS
1小时前
#include <iostream>
#include <limits.h>
#include <algorithm>

const int N=1e6+10;

int stkr[N],stkl[N],r,l;
int s[N],f[N];

using namespace std;

void push_backl(int x)
{
    stkl[++l]=x;
    s[l]=s[l-1]+x;
    f[l]=max(f[l-1],s[l]);
}

int main()
{
    int n;
    cin>>n;
    int x;
    char a[2];
    f[0] = INT_MIN;
    while(n--)
    {
        scanf("%s",a);
        if(*a=='I')
        {
            cin>>x;
            push_backl(x);
        }
        else if(*a=='D')
        {
            if(l>0) l--;
        }
        else if(*a=='L')
        {
            if(l>0) stkr[++r]=stkl[l--];
        }
        else if(*a=='R')
        {
            if(r>0)  push_backl(stkr[r--]);
        }
        else 
        {
            cin>>x;
            cout<<f[x]<<endl;
        }
    }

    return 0;
}



LAS
2小时前
class MinStack {
public:
    /** initialize your data structure here. */

    stack<int> stk,min_stk;
    MinStack() {

    }

    void push(int x) {
        stk.push(x);
        if(min_stk.size())x=min(min_stk.top(),x);
        min_stk.push(x);
    }

    void pop() {
        stk.pop();
        min_stk.pop();//顶部记录的一直是这个栈当中最小的,所以直接pop()
    }

    int top() {
        return stk.top();
    }

    int getMin() {
        return min_stk.top();
    }
};

/**
 * Your MinStack object will be instantiated and called as such:
 * MinStack obj = new MinStack();
 * obj.push(x);
 * obj.pop();
 * int param_3 = obj.top();
 * int param_4 = obj.getMin();
 */



LAS
2天前
递推与递归学习记录



活动打卡代码 AcWing 672. 税

LAS
2天前
#include<bits/stdc++.h>
using namespace std;

int main()
{
    double n;
    cin>>n;
    if(n>=0.00&&n<=2000.00)cout<<"Isento";
    else if(n>=2000.01&&n<=3000.00)cout<<fixed<<setprecision(2)<<"R$ "<<(n-2000.00)*0.08;
    else if(n>=3000.01&&n<=4500.00)cout<<fixed<<setprecision(2)<<"R$ "<<(n-3000.00)*0.18+80;
    else if(n>4500.00)cout<<fixed<<setprecision(2)<<"R$ "<<(n-4500.00)*0.28+350;
}


活动打卡代码 AcWing 671. DDD

LAS
2天前
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    if(n==61)cout<<"Brasilia";
    else if(n==71)cout<<"Salvador";
    else if(n==11)cout<<"Sao Paulo";
    else if(n==21)cout<<"Rio de Janeiro";
    else if(n==32)cout<<"Juiz de Fora";
    else if(n==19)cout<<"Campinas";
    else if(n==27)cout<<"Vitoria";
    else if(n==31)cout<<"Belo Horizonte";
    else cout<<"DDD nao cadastrado";
}


活动打卡代码 AcWing 670. 动物

LAS
2天前
#include<bits/stdc++.h>
using namespace std;

int main()
{
    string st1,st2,st3;
    cin>>st1>>st2>>st3;
    if(st1=="vertebrado"){
        if(st2=="ave"){
            if(st3=="carnivoro")cout<<"aguia";
            else cout<<"pomba";
        }
        else{
            if(st3=="onivoro")cout<<"homem";
            else cout<<"vaca";
        }
    }
    else {
        if(st2=="inseto"){
            if(st3=="hematofago")cout<<"pulga";
            else cout<<"lagarta";
        }
        else{
            if(st3=="hematofago")cout<<"sanguessuga";
            else cout<<"minhoca";
        }
    }
}


活动打卡代码 AcWing 669. 加薪

LAS
2天前
#include<bits/stdc++.h>
using namespace std;

int main()
{
    double n,c=0;
    cin>>n;
    cout<<fixed<<setprecision(2);
    if(n>=0&&n<=400)c=0.15;
    else if(n>=400.01&&n<=800)c=0.12;
    else if(n>=800.01&&n<=1200.00)c=0.1;
    else if(n>=1200.01&&n<=2000)c=0.07;
    else c=0.04;
    cout<<"Novo salario: "<<n*c+n<<endl;
    cout<<"Reajuste ganho: "<<n*c<<endl;
    cout<<"Em percentual: "<<int(c*100)<<" % ";
}


活动打卡代码 AcWing 668. 游戏时间2

LAS
2天前
#include<iostream>
using namespace std;
int a,b,c,d;
int main()
{
    cin>>a>>b>>c>>d;
    if(c==a){
        if(d-b<0)cout<<"O JOGO DUROU "<<23<<" HORA(S) E "<<60+d-b<<" MINUTO(S)";
        else if(b<d)cout<<"O JOGO DUROU "<<0<<" HORA(S) E "<<d-b<<" MINUTO(S)";
        else cout<<"O JOGO DUROU "<<24<<" HORA(S) E "<<d-b<<" MINUTO(S)";
    }
    if(c>a){
        if(d-b<0)cout<<"O JOGO DUROU "<<c-a-1<<" HORA(S) E "<<60+d-b<<" MINUTO(S)";
        else cout<<"O JOGO DUROU "<<c-a<<" HORA(S) E "<<d-b<<" MINUTO(S)";
    }
    if(c<a){
        if(d-b<0)cout<<"O JOGO DUROU "<<(24-a+c)-1<<" HORA(S) E "<<60+d-b<<" MINUTO(S)";
        else cout<<"O JOGO DUROU "<<24-c+a<<" HORA(S) E "<<d-b<<" MINUTO(S)";
    }
}


活动打卡代码 AcWing 667. 游戏时间

LAS
2天前
#include<iostream>
using namespace std;
int a,b;
int main()
{
    cin>>a>>b;
    if(a==b){
        cout<<"O JOGO DUROU "<<24<<" HORA(S)";
        return 0;
    }
    if(a>b){
        cout<<"O JOGO DUROU "<<24-a+b<<" HORA(S)";
        return 0;
    }
    if(a<b){
        cout<<"O JOGO DUROU "<<b-a<<" HORA(S)";
        return 0;
    }
}


活动打卡代码 AcWing 666. 三角形类型

LAS
2天前
#include<bits/stdc++.h>
using namespace std;
double a,b,c;
int main()
{
    cin>>a>>b>>c;
    if(a<b)swap(a,b);
    if(a<c)swap(a,c);
    if(b<c)swap(b,c);
    if(a>=b+c){
        cout<<"NAO FORMA TRIANGULO"<<endl;
        return 0;
    }
    if(a*a==b*b+c*c)cout<<"TRIANGULO RETANGULO"<<endl;
    if(a*a>b*b+c*c)cout<<"TRIANGULO OBTUSANGULO"<<endl;
    if(a*a<b*b+c*c)cout<<"TRIANGULO ACUTANGULO"<<endl;
    if(a*a==b*b&&b*b==c*c)cout<<"TRIANGULO EQUILATERO"<<endl;
    if(a==b&&b!=c||b==c&&a!=b)cout<<"TRIANGULO ISOSCELES"<<endl;
}