diff --git a/ATM2.cpp b/ATM2.cpp new file mode 100644 index 0000000..092914b --- /dev/null +++ b/ATM2.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; +int main() +{ + + int t, n; + cin>>t; + while(t-- > 0) + { + int i, p = 0, value = 0; + cin>>n; + cin>>p; + int a[n]; + for(i = 0; i < n; i++) + cin>>a[i]; + + for(i = 0; i < n; i++) + { + value = p-a[i]; + if(value >= 0) + { + cout<<"1"; + p = p-a[i]; + } + else + { + cout<<"0"; + } + + } + cout< +#include +#include +using namespace std; +int main() +{ + int t, n, i, j; + // string s; + cin>>t; + while(t--) + { + +int arr[5]; + for(i = 0; i < 5; i++) + { + cin>>arr[i]; + } + int count = 0; + for(i = 0; i < 5; i++) + { + if (arr[i] == 1) + { + count++; + } + } + if (count == 0) + { + cout<<"Beginner"< +#include +using namespace std; +int main() + +{ + int q; + cin>>q; + while (q--) + { + int ele = 0; + cin>>ele; + int i, a[ele], b[ele], c[ele]; + int j = 0; + j = ele-1; + int flag = 0; + int temp = 0, count = 0; + for (i = 0 ; i < ele; i++) + { + cin>>a[i]; + c[j] = a[i]; + j--; + } + for (i = 0; i < ele; i++) + { + cin>>b[i]; + } + for (i = 0; i < ele; i++) + { + + if (a[i] <= b[i]) + { + count++; + if (c[i] <= b[i]) + { + flag++; + } + } else if (c[i] <= b[i]) + { + flag++; + }else + { + count++; + } + } + + if (count == ele && flag == ele ) + { + cout<<"both"< +#include +using namespace std; +int main() +{ + int u; + int i, j, total; + cin>>u; + while(u--) + {int n, flag = 0; + int sum = 0; + cin>>n; + int a[n]; + for (i = 0; i < n; i++) + { + cin>>a[i]; + } + + total = accumulate(a, a+n, sum); + if (total%2 == 0) + { + cout<<"NO"< +#include +#include +#include +using namespace std; +int main() +{ + int t; + cin>>t; + while(t>0) + { + int n, target, count = 0; + cin>>n>>target; + int a[n], i; + for(i = 0; i < n; i++) + { + cin>>a[i]; + } + for (i = 0; i < n; i++) + { + if(a[i]%target == 0) + { + count++; + } + } + int ans = pow(2, count) - 1; + cout< +#include +#include +using namespace std; +int main() +{ + int t; + cin>>t; + while(t--) + { + int n,l, r, i; + cin>>l>>r; + int count = 0; + for (i = l; i <= r; i++) + { + if (i%10 == 2 || i%10 == 9 || i%10 == 3) + { + count++; + } + } + cout< +#include +using namespace std; +int main() +{ + int t; + cin>>t; + while(t--) + { + int a, b,c, j = 0, k= 0; + cin>>a>>b>>c; + j = abs(a); + k = abs(b); + + if ( c%2 == 0) + { + if (j > k) + { + cout<<"1"<b) + { + cout<<"1"< o) + { + cout<<"1"<