Advertisement
jakaria_hossain

Toph - Arithmetic Sequence (Easy)

Oct 2nd, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int n;
  5. scanf("%d",&n);
  6. n=n*(n+1)/2;
  7. int q;
  8. scanf("%d",&q);
  9. while(q--)
  10. {
  11. int x;
  12. scanf("%d",&x);
  13. n-=x;
  14. }
  15. printf("%d\n",n);
  16. return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement