fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int t;
  5. cin >> t;
  6. while (t--) {
  7. int n;
  8. cin >> n;
  9. int a[100];
  10.  
  11. for (int i = 0; i < n; ++i) {
  12. cin >> a[i];
  13. }
  14.  
  15. if (a[0] != a[1]) {
  16. if (a[0] == a[2]) {
  17. cout << 2 << endl;
  18. } else {
  19. cout << 1 << endl;
  20. }
  21. } else {
  22. for (int i = 2; i < n; ++i) {
  23. if (a[i] != a[0]) {
  24. cout << i + 1 << endl;
  25. break;
  26. }
  27. }
  28. }
  29. }
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty