fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_SIZE = 1000;
  5.  
  6. int main() {
  7. int dataSize, sentPackage[MAX_SIZE], recievedPackage[MAX_SIZE];
  8. cin >> dataSize;
  9. for (int i = 0; i < dataSize; ++i) {
  10. cin >> sentPackage[i];
  11. }
  12. for (int i = 0; i < dataSize - 1; ++i) {
  13. cin >> recievedPackage[i];
  14. }
  15. int missingPacket = 0;
  16. for (int i = 0; i < dataSize; ++i) {
  17. if (sentPackage[i] != recievedPackage[i]) {
  18. missingPacket = sentPackage[i];
  19. i = dataSize;
  20. }
  21. }
  22. cout << missingPacket;
  23. return 0;
  24. }
Success #stdin #stdout 0s 5284KB
stdin
10
34 32 45 -67 89 21 34 5 7 9
34 32 45 89 21 34 5 7 9
stdout
-67