diff --git a/Basic Input and Output/Aman_And_Sharma.c b/Basic Input and Output/Aman_And_Sharma.c new file mode 100644 index 0000000..edc01d4 --- /dev/null +++ b/Basic Input and Output/Aman_And_Sharma.c @@ -0,0 +1,32 @@ +/* +// Sample code to perform I/O: +#include + +int main(){ + int num; + scanf("%d", &num); // Reading input from STDIN + printf("Input number is %d.\n", num); // Writing output to STDOUT +} + +// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail +*/ + +// Write your code here + #include + int main() + { + int d,r,x,choc=0,i; + float dist,da; + scanf("%d",&d); + for(i=0;i=dist) + { + choc++; + } + } + printf("%d",choc); + } diff --git a/Basic Input and Output/Back_To_School.cpp b/Basic Input and Output/Back_To_School.cpp new file mode 100644 index 0000000..337fc79 --- /dev/null +++ b/Basic Input and Output/Back_To_School.cpp @@ -0,0 +1,18 @@ +#include +using namespace std; + +int main() +{ + int a,b,c; + cin>>a>>b>>c; + int max=c; + if(a>b && a>c) + { + max=a; + } + else if(b>c and b>a) + { + max=b; + } + cout< + +using namespace std; + +int main() { + int num; + cin >> num; // Reading input from STDIN + cout << "Input number is " << num << endl; // Writing output to STDOUT +} + +// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail +*/ + +// Write your code here +#include +using namespace std; + +int main() +{ + int num_test; + cin>>num_test; + for(int i=0;i>green; + cin>>purple; + int suma=0,sumb=0; + int number_of_players; + cin>>number_of_players; + for(int j=0;j>a; + cin>>b; + suma=suma+a; + sumb=sumb+b; + } + if(suma>sumb) + { + if(green>purple) + { + cout<<((green*sumb)+(purple*suma))<suma) + { + if(green>purple) + { + cout<<((green*suma)+(purple*sumb))<purple) + { + cout<<((green*suma)+(purple*sumb))< + +using namespace std; + +int main() { + int num; + cin >> num; // Reading input from STDIN + cout << "Input number is " << num << endl; // Writing output to STDOUT +} + +// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail +*/ + +// Write your code here +#include +using namespace std; + +int main() +{ + int a,b,c; + cin>>a>>b>>c; + int count=0; + for(int i=a;i<=b;i++) + { + if(i%c==0) + { + count++; + } + } + cout< + +using namespace std; + +int main() { + int num; + cin >> num; // Reading input from STDIN + cout << "Input number is " << num << endl; // Writing output to STDOUT +} + +// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail +*/ + +// Write your code here +#include +using namespace std; + +int main() +{ + int n,minskill; + cin>>n>>minskill; + int set[n]; + for(int i=0;i>set[i]; + } + + for(int i=0;i=minskill) + { + cout<<"YES"< + +int main(){ + int num; + scanf("%d", &num); // Reading input from STDIN + printf("Input number is %d.\n", num); // Writing output to STDOUT +} + +// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail +*/ + +// Write your code here + #include + int next(int n) + { + int i,ans; + int d1,d2; + int k[12]={67,71,73,79,83,89,97,101,103,107,109,113}; + if(n<=67) + { + ans=67; + } + else if(n>=113) + { + ans=113; + } + else + { + for(i=0;i<12;i++) + { + if(k[i]>n) + { + d1=k[i]-n ; + d2=n-k[i-1]; + if(d1 + #include + #include + + int min(int a, int b) + { + return a>b?b:a; + } + long long Solve (long long k, int* arr ,int n) + { + long long out = 0; + int i,j; + for (i=j=0; ik) + ++j; + while(arr[i]!=0 && (i+k)>=min(n-1,j)) + { + if(arr[j]>0) + { + j++; + continue; + } + int x = min(arr[i],abs(arr[j])); + arr[i]-=x; + arr[j]+=x; + if(arr[j]>=0) + j++; + } + } + for (i=0; i + +using namespace std; + +int main() { + int num; + cin >> num; // Reading input from STDIN + cout << "Input number is " << num << endl; // Writing output to STDOUT +} + +// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail +*/ + +// Write your code here +#include +using namespace std; + +int main() +{ + int n; + cin>>n; + int a[n]; + for(int i=0;i>a[i]; + } + for(int i=0;i + +int main(){ + int num; + scanf("%d", &num); // Reading input from STDIN + printf("Input number is %d.\n", num); // Writing output to STDOUT +} + +// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail +*/ + +// Write your code here + #include + + int main() + { + int n,i,s,t; + scanf("%d\n",&n); + for(i=0;i + +int main(){ + int num; + scanf("%d", &num); // Reading input from STDIN + printf("Input number is %d.\n", num); // Writing output to STDOUT +} + +// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail +*/ + +// Write your code here + #include + #include + int main() + { + int t; + scanf("%d", &t); + while(t--) + { + char a[100000]; + scanf("%s",a); + long n=strlen(a),newsum=0; + for(int j=0;j + +int main(){ + int num; + scanf("%d", &num); // Reading input from STDIN + printf("Input number is %d.\n", num); // Writing output to STDOUT +} + +// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail +*/ + +// Write your code here +#include +long long v[100001]; + +int main() { + int n; + scanf("%d", &n); + + for (int i = 0; i < n; i++) + scanf("%lld", &v[i]); + v[n] = 0; + + int x = 1, y = 2; + long long maxsum = v[n - 1]; + + for (int i = n - 1; i-- > 0; ) { + v[i] += v[i + 1]; + + long long newsum = v[i] - v[n - x]; + if (newsum > maxsum) + maxsum = newsum; + + if (++x == y) { + x = 0; + ++y; + } + } + + printf("%lld", maxsum); +} diff --git a/Basic Input and Output/find_product.cpp b/Basic Input and Output/find_product.cpp new file mode 100644 index 0000000..63e8ffd --- /dev/null +++ b/Basic Input and Output/find_product.cpp @@ -0,0 +1,37 @@ +/* +// Sample code to perform I/O: + +#include + +using namespace std; + +int main() { + int num; + cin >> num; // Reading input from STDIN + cout << "Input number is " << num << endl; // Writing output to STDOUT +} + +// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail +*/ + +// Write your code here +#include +#include +#include +using namespace std; +int main() +{ + int n; + cin>>n; + int arr[n]; + long answer=1; + for(int i=0;i>arr[i]; + } + for(int j=0;j