#include#define int long long using namespace std; signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int N,W,tW; cin>>N>>W; tW=W; int res=0,cnt=0, ress=0; while(N--){ int num; cin>>num; if(W>=num){ W-=num; cnt++; if(!W){ res++; W=tW; ress+=cnt; cnt=0; } } } cout< 用药统计 原题 算法标签 模拟 结构体 代码 #include#define int long long #define x first #define y second using namespace std; const int N = 10005, K = 15; struct Ill{ string id; int k; string drug[K]; }ill[N]; signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int N; map mp; vector vs; cin>>N; for(int i=0;i >ill[i].id>>ill[i].k; for(int j=0;j >ill[i].drug[j]; mp[ill[i].drug[j]]++; } } int mx=0 ; string mxidx=""; for(auto it: mp){ if(it.y>mx){ mx = it.y; mxidx = it.x; } } for(int i=0;i 五彩斑斓的黑 原题 算法标签 模拟 代码 #include#define int long long using namespace std; signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; unordered_map mp; cin>>n; for(int i=0;i >s; mp[s]++; } cout< 假新闻 原题 算法标签 模拟 排序 代码 #include#define int long long using namespace std; const int N = 10005, M = 105; int a[M][N], b[M][N], c[N], mx[M]; signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n,m; cin>>n>>m; for(int i=0;i >a[i][j]; } } for(int i=0;i Mx){ Mx = b[i][j]; } } mx[i]=Mx; } for(int i=0;i Max){ Max=c[i]; Maxidx=i; } } cout< 静态链表的秩 原题 算法标签 模拟 链表 排序 代码 排序 #include#define int long long using namespace std; const int N = 100005; int a[N], b[N], c[N], d[N]; signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin>>n; for(int i=0;i >a[i]; c[i]=a[i]; } sort(c, c+n); int head=0; for(int i=0;i 上述代码对于测试样例无问题,可能存在bug, 遇到问题欢迎一起交流沟通哈。
原创不易 转载请标明出处
如果对你有所帮助 别忘啦点赞支持哈



