Are you a fan of problem-solving and algorithmic challenges? Look no further than our Telegram channel, 'Competitive Programming with C++'! This channel is dedicated to helping you experience a new world of algorithmic problems using the powerful programming language, C++. Whether you are a beginner looking to improve your coding skills or an experienced programmer seeking new challenges, this channel is the perfect place for you.
Join our community of like-minded individuals who share a passion for competitive programming and C++. You can find the link to our channel here: https://t.me/Competitive_Programming_Cpp
Have questions or need assistance with a particular problem? Feel free to contact our channel administrator, @saranyanaharoy, who is always available to help. Additionally, we encourage you to share your own experiences and ideas with us. We love hearing from our members and will even showcase your contributions in our channel!
Don't miss out on the opportunity to challenge yourself, improve your coding skills, and connect with a community of fellow programmers. Join 'Competitive Programming with C++' today and start your journey towards becoming a master of algorithmic problem-solving!
17 Aug, 17:39
17 Aug, 07:23
20 Sep, 07:09
02 Jun, 13:14
02 Jun, 13:12
23 May, 08:27
15 Nov, 09:19
08 Nov, 15:06
03 Nov, 14:39
30 Oct, 06:02
23 Oct, 15:41
16 Oct, 10:28
09 Oct, 05:13
03 Oct, 05:29
void precompute(int prefixSum[])
prefixSum[0]=arr[0]
for i=1 to n-1 prefixSum[i]=prefixSum[i-1]+arr[i]
int rangesum(int l,int r,int prefixSum[])
if(l=0)
return prefixSum[r]
else
return prefixSum[r]-prefixSum[l-1]
void update(int i,int x,int prefixSum [],int arr[])
int diff = x-arr[i]
for j=i to n-1
prefixSum[j]=prefixSum[j]+diff
arr[i] = arr[i] + diff
29 Sep, 09:11
int fun(char *x){
char *ptr=x;
while(*ptr!=0)ptr++;
return (ptr-x);
}
int main(){
char str[30]="This is PDS test";
printf("%d",fun(str));
}
int main(){
int array[4]={20,18,16,14};
int *ptr=array;
printf("%d,%d",*ptr+2,*(ptr+2));
}
int *A,*B,C[10];
int main(){
int arr[3]={1,2};
int i;
for(i=0;i<3;i++){
printf("%d ");
}
}
22 Sep, 10:45
int Damage(int n, int a[],int p)Code:
int s = (n-(p+1)) + ceil(p/2)
int d = 0
if(p%2 != 0)
d = d + a[p]
int last = s
int step = 2
while( last != 1)
if((last-1)%step==0)
if(last<=(n-(p+1))
d = d + a[last+p]
else
d = d + a[2*(k-n+p)+1]
else
last = ((last-1)-(last-1)%step)+1
step = step*2
return d
int n,f
n,f=input
n=n-1
int a[n+1]
a[0] = 0;
for i = 1 to n
a[i]=input
int result[n]
initialize result with -1
for i=0 to n
if(a[i]<=f)
result[i]=damage(n,a,i)
int count=0
for i=0 to n
if(result[i]!=-1)
count=count+1
if(count==0)
print "impossible"
else
int index=n+1
int min_damage=INT_MAX
for i = n to 0
if(result[i] != -1 && result[i]<=min_damage)
index=i
min_damage=result[i]
print "possible\n"
print index+1
print min_damage+f
22 Sep, 10:45
20 Sep, 17:30
int pallin_dist(char ch[],int start,int end):
if(end==-1): //i.e end of string
return 0
ans=pallin_dist(ch,start+1,end-1)
if (ch[start]==ch[end]):
return ans
else:
return ans+1
15 Sep, 14:41