社区讨论

求助 关于dev-c++编译错误

灌水区参与者 3已保存回复 5

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
5 条
当前快照
1 份
快照标识符
@lr95szmu
此快照首次捕获于
2024/01/11 20:01
2 年前
此快照最后确认于
2024/01/12 00:11
2 年前
查看原帖
编译后再运行会先后出现下面两个图片
)
附上我的丑陋代码( P3396)
CPP
#include<bits/stdc++.h>
#define il inline
#define ll long long
//namespace fastIO
//{
//    template<typename T>
//    inline void read(T &ans){
//        char ch=getchar();int f=1;ans=0;
//        for(;!isdigit(ch);ch=getchar()) ch=='-'?f=-1:f=1;
//        for(;isdigit(ch);ch=getchar()) ans=(ans<<3)+(ans<<1)+(ch&15);
//        ans*=f;
//        return;
//    }
//    template<typename T,typename ...Args>
//    inline void read(T &tmp,Args &...tmps){read(tmp);read(tmps...);}
//    
//    template<class T>
//    inline void print(T ret,int flg=0){
//        static int sta[35];
//        T x=ret;int top=0;
//        bool f=(ret<0);
//        if(ret<0) x=-x;
//        do{sta[top++]=x%10,x/=10;}while(x);
//        if(f) putchar('-');
//        while(top) putchar(sta[--top]+48);
//        if(flg==0)putchar(' ');
//        else if(flg==1)putchar('\n');
//    }
//    
//} // namespace IO
using namespace std;

const int N = 150050;
char op;
int n , m , x , y;
long long v[N][N],a[N];

il void pb() {
	long long res = 0;
	for(int i = y ;i <= n ;i += x) res += a[i];
	cout << res ;
}

il void sol_A() {
	if(x <= sqrt(n)) cout << v[x][y];
	else pb();
}

il void sol_C() {
	for(int i = 1 ;i <= sqrt(n); ++i)
		v[i][x%i] += y - a[x]; 
	a[x] = y;
} 

int main() {
	//read(n,m);
	cin >>n>>m;
	for(int i = 1 ;i <= n; ++i) cout << a[i];
	for(int i = 1 ;i <= n; ++i) 
		for(int j = 1; j <= sqrt(n); ++j) 
			v[j][i%j] += a[i];
	while(m--) {
		cin >> op;
		cin >>x >>y;
		//read(x,y);
		if(op == 'A') sol_A();
		else if(op == 'C') sol_C();
	}
	return 0;
} 

回复

5 条回复,欢迎继续交流。

正在加载回复...