3.2w+
社区成员
目录
https://www.luogu.com.cn/problem/P2694
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <sstream>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <string>
#include <cstring>
#define x first
#define y second
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef pair<int,int> PII;
typedef pair<char,int> PCI;
typedef long long LL;
typedef unsigned long long ULL;
const int N= 1e4 + 10 , INF = 1e9 ;
int n;
PII q[N];
bool cmp(PII a,PII b)
{
return a.y < b.y;
}
void solve()
{
cin>>n;
for(int i=0;i<n;i ++ )
{
cin>>q[i].x>>q[i].y;
}
sort(q,q+n,cmp);
LL t =0,cnt=0;bool flag=0;
for(int i=0;i <n ;i ++ )
{
if(abs(t-q[i].x) > q[i].y - cnt)
{
flag =1 ;break;
}
cnt=q[i].y;
t = q[i].x;
}
if(flag ) puts("Notabletocatch");
else puts("Abletocatch");
}
int main()
{
ios
int T;cin>>T;
while(T -- )
{
solve();
}
return 0;
}
https://www.luogu.com.cn/problem/P1372
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <sstream>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <string>
#include <cstring>
#define x first
#define y second
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef pair<int,int> PII;
typedef pair<char,int> PCI;
typedef long long LL;
typedef unsigned long long ULL;
const int N= 1e4 + 10 , INF = 1e9 ;
int n,m;
PII q[N];
void solve()
{
cin>>n>>m;
cout<<n /m <<endl;
}
int main()
{
ios
int T=1;
// cin>>T;
while(T -- )
{
solve();
}
return 0;
}
https://www.luogu.com.cn/problem/P1106
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <sstream>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <string>
#include <cstring>
#define x first
#define y second
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef pair<int,int> PII;
typedef pair<char,int> PCI;
typedef long long LL;
typedef unsigned long long ULL;
const int N= 1e4 + 10 , INF = 1e9 ;
int n,m;
PII q[N];
void solve()
{
string s;cin>>s>>n;
while(n -- )
{
bool flag =0;
for(int i=0;i < s.size() -1 ;i ++ )
{
if(s[i] > s[i + 1])
{
flag =1;
s = s.substr(0,i) + s.substr(i+1);
// 删掉 第 i 个数
break;
}
}
if(!flag) // 没有找到 要删的 数 说明 这个从前往后 是 递增的
s = s.substr(0,s.size()-1) ; // 否则删掉 最后一个 数
}
int i=0;
while(i < s.size() && s[i] == '0') i ++ ;
if(i == s.size()) cout<<0 << endl;
else
{
for(int j =i;j <s.size() ; j++)cout<<s[j];
}
}
int main()
{
ios
int T=1;
// cin>>T;
while(T -- )
{
solve();
}
return 0;
}
https://www.lanqiao.cn/problems/545/learning/
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <sstream>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <string>
#include <cstring>
#define x first
#define y second
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
typedef pair<int,int> PII;
typedef pair<char,int> PCI;
typedef long long LL;
typedef unsigned long long ULL;
const int N= 1e4 + 10 , INF = 1e9 ;
int n,m;
priority_queue<int,vector<int>,greater<int>> q;
void solve()
{
cin>>n;
for(int i=0; i< n ;i ++ )
{
int t;cin>>t;
q.push(t);
}
LL res=0;
while(q.size() > 1)
{
auto x = q.top(); q.pop();
auto y = q.top();q.pop();
res += (LL)x+y;
q.push(x +y);
}
cout << res << endl;
}
int main()
{
ios
int T=1;
// cin>>T;
while(T -- )
{
solve();
}
return 0;
}