A 数字判断
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define re register
#define lll __int128
#define gc getchar
#define pt putchar
#define int long long
using namespace std;
const int SIZE=1<<14;
inline int read(){
re int x=0;re bool f=0;static char ch=gc();
while(!(ch>=48&&ch<=57)&&ch!=EOF){if(ch=='-')f=1;ch=gc();}
while(ch>=48&&ch<=57){x*=10;x+=(ch-48);ch=gc();}
if(f)return -x;else return x;
}
void print(int x){
char st[105];re int top=0;
if(x==0)putchar('0');if(x<0)putchar('-');
while(x){if(x>0)st[++top]=x%10+48;else st[++top]=-(x%10)+48;x/=10;}
while(top)putchar(st[top--]);
}
void println(int x){
print(x);putchar('\n');
}
void printsp(int x){
print(x);putchar(' ');
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int a,b,c;
cin>>a>>b>>c;
if(a+b+c<=100&&b%5==0&&c%7==0&&a-b>b-c)
cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}
B 团伙首领
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define re register
#define lll __int128
#define gc getchar
#define pt putchar
#define int long long
using namespace std;
const int SIZE=1<<14;
inline int read(){
re int x=0;re bool f=0;static char ch=gc();
while(!(ch>=48&&ch<=57)&&ch!=EOF){if(ch=='-')f=1;ch=gc();}
while(ch>=48&&ch<=57){x*=10;x+=(ch-48);ch=gc();}
if(f)return -x;else return x;
}
void print(int x){
char st[105];re int top=0;
if(x==0)putchar('0');if(x<0)putchar('-');
while(x){if(x>0)st[++top]=x%10+48;else st[++top]=-(x%10)+48;x/=10;}
while(top)putchar(st[top--]);
}
void println(int x){
print(x);putchar('\n');
}
void printsp(int x){
print(x);putchar(' ');
}
int a[1000006];
int f[1000006];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
int maxn=0;
for(int i=1;i<=n;i++){
cin>>a[i];
f[a[i]]++;
maxn=max(maxn,a[i]);
}
int ans=0;
for(int i=1;i<=maxn;i++)
if(f[i])ans++;
cout<<ans<<endl;
return 0;
}
C 枚举结构
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define re register
#define lll __int128
#define gc getchar
#define pt putchar
#define int long long
using namespace std;
const int SIZE=1<<14;
inline int read(){
re int x=0;re bool f=0;static char ch=gc();
while(!(ch>=48&&ch<=57)&&ch!=EOF){if(ch=='-')f=1;ch=gc();}
while(ch>=48&&ch<=57){x*=10;x+=(ch-48);ch=gc();}
if(f)return -x;else return x;
}
void print(int x){
char st[105];re int top=0;
if(x==0)putchar('0');if(x<0)putchar('-');
while(x){if(x>0)st[++top]=x%10+48;else st[++top]=-(x%10)+48;x/=10;}
while(top)putchar(st[top--]);
}
void println(int x){
print(x);putchar('\n');
}
void printsp(int x){
print(x);putchar(' ');
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
char x,z;
int y,w;
cin>>x;
cin>>y;
cin>>z;
cin>>w;
if('a'<=x&&x<='z'&&'a'<=z&&z<='z'&&x==z){
cout<<"valid"<<endl;
if(y<=w){
cout<<w-y+1<<endl;
}
else cout<<y-w+1<<endl;
}
else {
cout<<"Invalid"<<endl;
cout<<-1<<endl;
}
return 0;
}
D 塔台超频
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define re register
#define lll __int128
#define gc getchar
#define pt putchar
#define int long long
using namespace std;
const int SIZE=1<<14;
inline int read(){
re int x=0;re bool f=0;static char ch=gc();
while(!(ch>=48&&ch<=57)&&ch!=EOF){if(ch=='-')f=1;ch=gc();}
while(ch>=48&&ch<=57){x*=10;x+=(ch-48);ch=gc();}
if(f)return -x;else return x;
}
void print(int x){
char st[105];re int top=0;
if(x==0)putchar('0');if(x<0)putchar('-');
while(x){if(x>0)st[++top]=x%10+48;else st[++top]=-(x%10)+48;x/=10;}
while(top)putchar(st[top--]);
}
void println(int x){
print(x);putchar('\n');
}
void printsp(int x){
print(x);putchar(' ');
}
int a[500005],b[500005];
int n,maxn;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
for(int i=1;i<=n;i++)
cin>>a[i]>>b[i];
for(int i=2;i<=n;i++){
int x=a[i]-a[i-1];
if(x<=b[i-1])continue;
else maxn=max(maxn,x-b[i-1]);
}
cout<<maxn<<endl;
return 0;
}
E 署前街少年
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define re register
#define lll __int128
#define gc getchar
#define pt putchar
#define int long long
using namespace std;
const int SIZE=1<<14;
inline int read(){
re int x=0;re bool f=0;static char ch=gc();
while(!(ch>=48&&ch<=57)&&ch!=EOF){if(ch=='-')f=1;ch=gc();}
while(ch>=48&&ch<=57){x*=10;x+=(ch-48);ch=gc();}
if(f)return -x;else return x;
}
void print(int x){
char st[105];re int top=0;
if(x==0)putchar('0');if(x<0)putchar('-');
while(x){if(x>0)st[++top]=x%10+48;else st[++top]=-(x%10)+48;x/=10;}
while(top)putchar(st[top--]);
}
void println(int x){
print(x);putchar('\n');
}
void printsp(int x){
print(x);putchar(' ');
}
int a[5000006];
int f[5000006];
int p[5000006];
int ph[50000006];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,k;
cin>>n>>k;
for(int i=1;i<=2*n;i++)
cin>>a[i];
for(int i=1;i<=2*n;i++){
if(i%2==0)f[i]=0;
else f[i]=1;
}
for(int i=1;i<=2*n;i++){
p[i]=i%k;
}
for(int i=1;i<=2*n;i++){
ph[p[i]]+=a[i];
}
for(int i=1;i<=2*n;i++)
if(i%2==1)a[i]=ph[p[i]]%i;
for(int i=1;i<=2*n;i++)
cout<<a[i]<<' ';
return 0;
}
F 扶苏和串
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define re register
#define lll __int128
#define gc getchar
#define pt putchar
#define int long long
using namespace std;
const int SIZE=1<<14;
inline int read(){
re int x=0;re bool f=0;static char ch=gc();
while(!(ch>=48&&ch<=57)&&ch!=EOF){if(ch=='-')f=1;ch=gc();}
while(ch>=48&&ch<=57){x*=10;x+=(ch-48);ch=gc();}
if(f)return -x;else return x;
}
void print(int x){
char st[105];re int top=0;
if(x==0)putchar('0');if(x<0)putchar('-');
while(x){if(x>0)st[++top]=x%10+48;else st[++top]=-(x%10)+48;x/=10;}
while(top)putchar(st[top--]);
}
void println(int x){
print(x);putchar('\n');
}
void printsp(int x){
print(x);putchar(' ');
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string s,now,ans;
cin>>s;
ans=s;
int len=s.length();
for(int i=0;i<len;i++)
for(int j=i;j<len;j++){
now=s;
for(int k=0;k<=(j-i)/2;k++)
swap(now[i+k],now[j-k]);
if(now<ans)
ans=now;
}
cout<<ans<<endl;
return 0;
}
G Three-View Projection
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define re register
#define lll __int128
#define gc getchar
#define pt putchar
#define int long long
using namespace std;
const int SIZE=1<<14;
inline int read(){
re int x=0;re bool f=0;static char ch=gc();
while(!(ch>=48&&ch<=57)&&ch!=EOF){if(ch=='-')f=1;ch=gc();}
while(ch>=48&&ch<=57){x*=10;x+=(ch-48);ch=gc();}
if(f)return -x;else return x;
}
void print(int x){
char st[105];re int top=0;
if(x==0)putchar('0');if(x<0)putchar('-');
while(x){if(x>0)st[++top]=x%10+48;else st[++top]=-(x%10)+48;x/=10;}
while(top)putchar(st[top--]);
}
void println(int x){
print(x);putchar('\n');
}
void printsp(int x){
print(x);putchar(' ');
}
int a[1005][1005];
int zheng[1005];
int zuo[1005];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++){
cin>>a[i][j];
if(a[i][j]==1){
zheng[i]=1;
zuo[j]=1;
}
}
for(int i=1;i<=n;i++)
cout<<zheng[i]<<' ';
cout<<endl;
for(int i=m;i>=1;i--)
cout<<zuo[i]<<' ';
cout<<endl;
for(int i=m;i>=1;i--){
for(int j=1;j<=n;j++)
cout<<a[j][i]<<' ';
cout<<endl;
}
return 0;
}
H 魔法少女扶苏
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define re register
#define lll __int128
#define gc getchar
#define pt putchar
#define int long long
using namespace std;
const int SIZE=1<<14;
inline int read(){
re int x=0;re bool f=0;static char ch=gc();
while(!(ch>=48&&ch<=57)&&ch!=EOF){if(ch=='-')f=1;ch=gc();}
while(ch>=48&&ch<=57){x*=10;x+=(ch-48);ch=gc();}
if(f)return -x;else return x;
}
void print(int x){
char st[105];re int top=0;
if(x==0)putchar('0');if(x<0)putchar('-');
while(x){if(x>0)st[++top]=x%10+48;else st[++top]=-(x%10)+48;x/=10;}
while(top)putchar(st[top--]);
}
void println(int x){
print(x);putchar('\n');
}
void printsp(int x){
print(x);putchar(' ');
}
int a[1005][1005];
int n,m,k;
bool get_ans(int num){
int ans=0;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++){
int sum=0;
for(int x=1;x<=n;x++)
sum+=a[x][j]-num;
for(int y=1;y<=m;y++)
sum+=a[i][y]-num;
sum+=num;
if(a[i][j]>=sum)ans++;
}
if(ans>=k)return true;
else return false;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>m>>k;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
cin>>a[i][j];
int l=0;
int r=1919810;
while(l+1!=r){
int mid=(l+r)/2;
if(get_ans(mid)){
r=mid;
}
else l=mid;
}
cout<<r<<endl;
return 0;
}
I std::string
#include <iostream>
using namespace std;
int main() {
int taskId;
cin >> taskId;
if (taskId == 1) {
cout << "100000" <<endl;
} else if (taskId == 2) {
cout << "3 0 1 0" << endl;
} else { // 这个 else 不会被执行
cout << "Stupid Fusu!" << endl;
}
}
标签:145,洛谷,48,int,ak,putchar,include,top,define
From: https://www.cnblogs.com/CheZiHe929/p/17555526.html