eclipse运行结果没错,提交时CE,帮忙看看
查看原帖
eclipse运行结果没错,提交时CE,帮忙看看
1171386
LG1353495楼主2025/1/16 22:23
package _01;

import java.util.Iterator;

import java.util.Scanner;

@SuppressWarnings("unused")

public class test {

@SuppressWarnings("resource")

public static void main(String[] args) {

Scanner scanner=new Scanner(System.in);

int n,m,q,w,z;

n=scanner.nextInt();
m=scanner.nextInt();

int[] a=new int[n];

for(int i=0;i<n;i++) {
	a[i]=scanner.nextInt();
}

for(int i=0;i<m;i++) {
	z=scanner.nextInt();
	q=scanner.nextInt();
	w=scanner.nextInt();
  
if(z==1) {
		a[q-1]=a[q-1]+w;
	}

else if(z==2){
				z=0;
        
for(int j=q-1;j<=w-1;j++)

z+=a[j];

System.out.println(z);
			}
		}
	}
}
2025/1/16 22:23
加载中...