Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- problem1
- int main()
- {
- int arr[1000],n,i,j,rev[1000];
- scanf("%d",&n);
- for(i=0;i<n;i++)
- {
- scanf("%d",&arr[i]);
- ///change
- rev[n-1-i]=arr[i];
- }
- for(j=0;j<n;j++)
- {
- printf("%d ",rev[j]);
- }
- return 0;
- }
- problem 2
- #include<stdio.h>
- int main()
- {
- int t,i,j;
- long int a,b,mod;
- scanf("%d",&t);
- for(i=1; i<=t; i++)
- {
- scanf("%ld %ld",&a,&b);
- mod=a%b;
- if(mod!=0)
- printf("%d\n",b-mod);
- else
- printf("0\n");
- }
- }
- problem 3
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- long long x, y, a, b,t;
- cin>>t;
- for(int i=0;i<t;i++)
- {
- cin>>x>>y>>a>>b;
- if((y-x)%(a+b)==0)
- cout<<(y-x)/(a+b)<<endl;
- else
- cout<<"-1"<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement