社区讨论
关于%lld和%I64d的问题
学术版参与者 7已保存回复 26
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 26 条
- 当前快照
- 1 份
- 快照标识符
- @mi6yl2o2
- 此快照首次捕获于
- 2025/11/20 12:56 4 个月前
- 此快照最后确认于
- 2025/11/20 16:29 4 个月前
如题所示
众所周知...NOIp考试用的Linux系统,所以应当使用
但是在今天的考试中...(机房XP32位)我错用了去输出类型了,由于使用cena测评系统,爆WA了两个点...但是用lemon测就过了...这是一个很奇怪的问题...我又比较弱,自己看不出来到底是为什么,所以在这里和大家讨论一下什么时候该用,什么时候又该用呢?
顺便附上今天我爆错的代码...求一个序列前m位的和..
C#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn = 1e7+10;
const int mod = 1e9;
priority_queue <int> q;
int n,m,x,y;
long long ans,calc;
int num[maxn];
int main() {
freopen("shop.in","r",stdin);
freopen("shop.out","w",stdout);
scanf("%d%d",&n,&m);
scanf("%d%d",&x,&y);
num[1]=x;
for (int i=2; i<=n; i++) {
calc=((LL)y*(LL)num[i-1]+(LL)x)%mod;
num[i]=(int)calc;
}
for (int i=1; i<=m; i++) {
q.push(num[i]);
ans+=num[i];
}
for (int i=m+1; i<=n; i++) {
if (q.top()>num[i]) {
ans-=q.top();
ans+=num[i];
q.pop();
q.push(num[i]);
}
}
printf("%lld\n",ans);
return 0;
}
回复
共 26 条回复,欢迎继续交流。
正在加载回复...