CYHMMZDAN

1.5万

Amani.
ø_70
tt2767

NIMBUS

hafu
currylin

An气质女孩

......_519
52Hertz_99
yxcの小迷弟

ZhengCheng

CYHMMZDAN
1个月前


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
static int l=0;
static int r=0;
static int z=0;
static int n=0;
static int[] b=new int[20];
static int[] c=new int[20];

static int ans=0;
public static void main(String[] args)throws IOException {
Scanner sc = new Scanner(System.in);
n=sc.nextInt();
l=sc.nextInt();
r=sc.nextInt();
z=sc.nextInt();
for (int i=1;i<=n;i++){
b[i]=sc.nextInt();
}
dfs(0,0,0,1,1);
System.out.println(ans);
}
public static void dfs(int a,int sum,int cha,int x,int x1){
if (a>=2&&sum>=l&&sum<=r&&cha>=z){
ans++;
}
if (sum>r){
return;
}
for (int i=x;i<=n;i++){
c[x1]=b[i];
int v=c[x1];
Arrays.sort(c,1,x1+1);
dfs(a+1,sum+v,c[x1]-c[1],i+1,x1+1);
c[x1]=0;
}
}

}



CYHMMZDAN
1个月前


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
public static void main(String[] args)throws IOException {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
int z=sc.nextInt();
System.out.printf("%.4f",(double)n*m/m+z);
}

}



CYHMMZDAN
2个月前


import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
static long[] a=new long[1000005];
static long[] b=new long[1000005];
static int[] c=new int[200005];
static int[] d=new int[500005];
static int[] e=new int[200005];
static int[] f=new int[200005];
static int t=520;
static int ans=0;
static int max=-1;
static int min=(int)2e+9;
static int n=0;
static int m=0;
static int sum=0;
static int l=0;
static int r=0;

static HashMap<Integer,Integer> map=new HashMap<>();
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
m=sc.nextInt();
long sum=0;
t=n;
for(int i=1;i<=n;i++) {
a[i]=sc.nextInt();
sum+=Math.pow(m,t-i)*a[i];
}
n=sc.nextInt();
r=sc.nextInt();
t=n;
long sum1=0;
for(int i=1;i<=n;i++) {
b[i]=sc.nextInt();
sum1+=Math.pow(r,t-i)*b[i];
}
if(sum>sum1) {
System.out.println(">");
}
else if(sum==sum1) {
System.out.println("=");
}
else {
System.out.println("<");
}

}
}



CYHMMZDAN
2个月前


import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
static int[] a=new int[3000005];
static long[] b=new long[1000005];
static int[] c=new int[200005];
static int[] d=new int[500005];
static int[] e=new int[200005];
static int[] f=new int[3000005];
static int t=520;
static int ans=0;
static int max=-1;
static int min=(int)2e+9;
static int n=0;
static int m=0;
static int sum=0;
static int l=0;
static int r=0;

static HashMap<Integer,Integer> map=new HashMap<>();
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
m=sc.nextInt();
for(int i=1;i<=n;i++) {
l=sc.nextInt();
r=sc.nextInt();
if(r-m<=0) {
t=0;
}else{
t=r-m;
}
f[t]+=l;
f[r+m+1]-=l;
}
a[0]=f[0];
max=a[0];
for(int i=1;i<=1000000;i++) {
a[i]=f[i]+a[i-1];
max=Math.max(max,a[i]);
}

System.out.println(max);
}
}



CYHMMZDAN
2个月前


import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
static long[] a=new long[1000005];
static long[] b=new long[1000005];
static int[] c=new int[200005];
static int[] d=new int[500005];
static int[] e=new int[200005];
static int[] f=new int[200005];
static int t=520;
static int ans=0;
static int max=-1;
static int min=(int)2e+9;
static int n=0;
static int m=0;
static int sum=0;
static int l=0;
static int r=0;

static HashMap<Integer,Integer> map=new HashMap<>();
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
for(int i=1;i<=n;i++) {
l=sc.nextInt();
r=sc.nextInt();
m=sc.nextInt();
f[l]+=m;
f[r]-=m;
}
for(int i=1;i<=1000;i++) {
sum+=f[i];
max=Math.max(max,sum);
}
System.out.println(max);

}
}



CYHMMZDAN
2个月前


import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
static long[] a=new long[1000005];
static long[] b=new long[1000005];
static int[] c=new int[200005];
static int[] d=new int[500005];
static int[] e=new int[200005];
static int[] f=new int[200005];
static int t=520;
static int ans=0;
static int max=-1;
static int min=(int)2e+9;
static int n=0;
static int m=0;
static int sum=0;
static int l=0;
static int r=0;

static HashMap<Integer,Integer> map=new HashMap<>();
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
m=sc.nextInt();
for(int i=1;i<=n;i++) {
l=sc.nextInt();
f[l]++;
max=Math.max(max,l);
min=Math.min(min,l);
}
if(min==max){
System.out.println(ans);
}
else{
for(int i=200003;i>min;i--) {
f[i]+=f[i+1];
if(sum+f[i]>m) {
ans++;
sum=f[i];
}
else{
sum+=f[i];
}
}
System.out.println(sum>0?ans+1:ans);
}
}
}



CYHMMZDAN
2个月前
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
static long[] a=new long[1000005];
static long[] b=new long[1000005];
static int[] c=new int[200005];
static int[] d=new int[500005];
static int[] e=new int[200005];
static int[] f=new int[200005];
static int t=520;
static int ans=0;
static int max=-1;
static int min=(int)2e+9;
static int n=0;
static int m=0;
static int sum=0;
static int l=0;
static int r=0;

static HashMap<Integer,Integer> map=new HashMap<>();
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
for(int i=1;i<=n;i++) {
l=sc.nextInt();
max=Math.max(max,l);
}
System.out.println(l^max);

}
}


CYHMMZDAN
2个月前


import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
static long[] a=new long[1000005];
static long[] b=new long[1000005];
static int[] c=new int[200005];
static int[] d=new int[500005];
static int[] e=new int[200005];
static int[] f=new int[200005];
static int t=520;
static int ans=0;
static int max=-1;
static int min=(int)2e+9;
static int n=0;
static int m=0;
static int sum=0;
static int l=0;
static int r=0;

static HashMap<Integer,Integer> map=new HashMap<>();
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
m=sc.nextInt();
long l=m;
long r=0;
long sum=0;
long max=0;
long min=1000000005;
for(int i=1;i<=n;i++) {
sum+=sc.nextInt();
if(sum>=0) {
if(sum>=max) {
l=m-sum;
max=sum;
}
}
else {
if(sum<min) {
r=sum;
min=sum;
}
}
}
r=Math.abs(r);
if(l>=r) {
System.out.println(l-r+1);
}
else {
System.out.println(0);
}
}
}



CYHMMZDAN
2个月前


import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
static long[] a=new long[1000005];
static long[] b=new long[1000005];
static int[] c=new int[200005];
static int[] d=new int[500005];
static int[] e=new int[200005];
static int[] f=new int[200005];
static int t=520;
static int ans=0;
static int max=-1;
static int min=(int)2e+9;
static int n=0;
static int m=0;
static int sum=0;
static int l=0;
static int r=0;

static HashMap<Integer,Integer> map=new HashMap<>();
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
m=sc.nextInt();
long l=m;
long r=0;
long sum=0;
long max=0;
long min=1000000005;
for(int i=1;i<=n;i++) {
sum+=sc.nextInt();
if(sum>=0) {
if(sum>=max) {
l=m-sum;
max=sum;
}
}
else {
if(sum<min) {
r=sum;
min=sum;
}
}
}
r=Math.abs(r);
if(l>=r) {
System.out.println(l-r+1);
}
else {
System.out.println(0);
}
}
}



CYHMMZDAN
2个月前


import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
static long[] a=new long[1000005];
static long[] b=new long[1000005];
static int[] c=new int[200005];
static int[] d=new int[500005];
static int[] e=new int[200005];
static int[] f=new int[200005];
static int t=520;
static int ans=0;
static int max=-1;
static int min=(int)2e+9;
static int n=0;
static int m=0;
static int sum=0;
static int l=0;
static int r=0;

static HashMap<Integer,Integer> map=new HashMap<>();
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String s=sc.nextLine();
if(s.charAt(0)=='1'&&s.length()==1){
System.out.println(ans);
System.exit(0);
}
StringBuilder s1=new StringBuilder();
t=s.length()-1;
while(t>=0&&s.charAt(t)!='1') {
t--;
}
l=t;
ans=s.length()-t-1;
if(t==0){
System.out.println(ans);
System.exit(0);
}
s1.append(s.substring(0,t+1));
while(true) {
if(s1.length()==1) {
break;
}
r=s1.length()-1;
while(s1.charAt(l)!='0') {
if(l==0){
break;
}
l--;
}
ans+=(1+(r-l));
if(l==0){
break;
}

s1.delete(l,r+1);
s1.append('1');
if(s1.length()==1) {
break;
}
}
System.out.println(ans+1);
}
}