wslwslwsl

8458

1..

someone

Loki
rizon

SELFIE1
hySensei

bwh

Timi
qiao
Pierre
Lxc_pyrola

wslwslwsl
3个月前

### 算法

#### C++ 代码

#include <iostream>
using namespace std;
int main()
{
char op;
double a,s = 0;
cin >> op;
for(int i = 0;i < 12;i ++)
{
for(int j = 0;j < 12;j ++)
{
cin >>a;
if(j > i) s += a;
}
}
printf("%.1lf",op=='S' ? s : s/66);
return 0;
}


wslwslwsl
4个月前
#include <iostream>
using namespace std;
const int N = 1000010;
int n,k;
int a[N],q[N];
int main()
{
cin>>n>>k;
for(int i = 0;i < n;i ++)
cin>>a[i];
int hh = 0,tt = -1;
for(int i = 0;i < n;i ++)
{
if(hh <= tt && i - k + 1 > q[hh])
hh ++;
while(hh <= tt && a[q[tt]] >= a[i])
tt --;
q[ ++ tt ] = i;
if(i >= k - 1)
cout<<a[q[hh]]<<" ";
}
cout<<endl;
hh = 0,tt = -1;
for(int i = 0;i < n;i ++)
{
if(hh <= tt && i - k + 1 > q[hh])
hh ++;
while(hh <= tt && a[q[tt]] <= a[i])
tt --;
q[ ++ tt ] = i;
if(i >= k - 1)
cout<<a[q[hh]]<<" ";
}
cout<<endl;
}


wslwslwsl
4个月前
#include <iostream>
using namespace std;
const int N = 100010;
int n;
int s[N],tt;
int main()
{
cin>>n;
for(int i = 1;i <= n;i ++)
{
int x;
cin>>x;
while(tt && s[tt] >= x)
tt --;
if(tt)
cout<<s[tt]<<" ";
else
cout<<"-1 ";
s[++tt] = x;
}
return 0;
}


wslwslwsl
4个月前
#include <iostream>
using namespace std;
const int N = 100010;
int stk[N],tt;
void push(int x)
{
stk[ ++ tt ] = x;
}
void pop()
{
tt --;
}
bool empty()
{
return !tt;
}
{
return stk[tt];
}
int main()
{
int n;
cin>>n;
while (n -- )
{
string s;
cin>>s;
if(s == "push")
{
int x;
cin>>x;
push(x);
}
else if(s == "pop")
{
pop();
}
else if(s == "empty")
{
cout<<(empty()?"YES\n":"NO\n");
}
else
{
}
}
return 0;
}


wslwslwsl
4个月前
#include <iostream>
using namespace std;
const int N = 100010;
int q[N],tt = -1,hh;
void push(int x)
{
q[ ++ tt ] = x;
}
void pop()
{
hh ++;
}
bool empty()
{
return !(hh <= tt);
}
int main()
{
int n;
cin>>n;
while (n -- )
{
string s;
cin>>s;
if(s == "push")
{
int n;
cin>>n;
push(n);
}
else if(s == "pop")
pop();
else if(s == "query")
cout<<q[hh]<<endl;
else
cout<<(empty()?"YES\n":"NO\n");
}
return 0;
}


wslwslwsl
4个月前
#include <iostream>
using namespace std;
const int N = 100010;
int q[N],tt = -1,hh;
void push(int x)
{
q[ ++ tt ] = x;
}
void pop()
{
hh ++;
}
bool empty()
{
return !(hh <= tt);
}
int main()
{
int n;
cin>>n;
while (n -- )
{
string s;
cin>>s;
if(s == "push")
{
int n;
cin>>n;
push(n);
}
else if(s == "pop")
pop();
else if(s == "query")
cout<<q[hh]<<endl;
else
cout<<(empty()?"YES\n":"NO\n");
}
return 0;
}


wslwslwsl
4个月前
#include <iostream>
using namespace std;
const int N = 100010;
void init()
{
idx = 0;
}
{
}
void insert(int k,int x)
{
e[idx] = x,ne[idx] = ne[k],ne[k] = idx ++;
}
void remove(int k)
{
if(k == -1)
else
ne[k] = ne[ne[k]];
}
int main()
{
init();
int n;
cin>>n;
while (n -- )
{
char op;
cin>>op;
int k,x;
if(op == 'H')
{
cin>>x;
}
else if(op == 'D')
{
cin>>k;
remove(k - 1);
}
else
{
cin>>k>>x;
insert(k - 1, x);
}
}
for(int i = head;i != -1;i = ne[i])
cout<<e[i]<<" ";
return 0;
}


wslwslwsl
4个月前
#include <cstdio>
int main()
{
int n;
scanf("%d", &n);
printf("%d ano(s)\n%d mes(es)\n%d dia(s)\n", n / 365 , n % 365 / 30 , n % 365 % 30);
return 0;
}


wslwslwsl
4个月前
#include <iostream>
using namespace std;
int main()
{
double a;
int n;
cin >> a;
n = a * 100;
cout << "NOTAS:" << endl;
cout << n / 10000 << " nota(s) de R$100.00" << endl; n %= 10000; cout << n / 5000 << " nota(s) de R$ 50.00" << endl;
n %= 5000;
cout << n / 2000 << " nota(s) de R$20.00" << endl; n %= 2000; cout << n / 1000 << " nota(s) de R$ 10.00" << endl;
n %= 1000;
cout << n / 500 << " nota(s) de R$5.00" << endl; n %= 500; cout << n / 200 << " nota(s) de R$ 2.00" << endl;
n %= 200;
cout << "MOEDAS:" << endl;
cout << n / 100 << " moeda(s) de R$1.00" << endl; n %= 100; cout << n / 50 << " moeda(s) de R$ 0.50" << endl;
n %= 50;
cout << n / 25 << " moeda(s) de R$0.25" << endl; n %= 25; cout << n / 10 << " moeda(s) de R$ 0.10" << endl;
n %= 10;
cout << n / 5 << " moeda(s) de R$0.05" << endl; n %= 5; cout << n << " moeda(s) de R$ 0.01" << endl;
return 0;
}


wslwslwsl
4个月前
#include <cstdio>
int main()
{
unsigned long long a, b;
scanf("%llu%llu", &a, &b);
printf("%.3lf", a * b / 12.0);
return 0;
}