fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int t, arr[10], minVal, minVal2, minIndex, minIndex2;
  7. cin>>t;
  8. while(t--) {
  9. minVal=15; minVal2=15; minIndex=-1; minIndex2=-1;
  10. for(int i=0; i<10; i++) {
  11. cin>>arr[i];
  12. if(arr[i]<minVal) {
  13. minVal=arr[i]; minIndex=i;
  14. }
  15. else if(arr[i]<minVal2 && i!=0) {
  16. minVal2=arr[i]; minIndex2=i;
  17. }
  18. }
  19. if(minIndex!=0) for(;minVal>=0; minVal--) cout<<minIndex;
  20. else if(minVal==minVal2) for(;minVal2>=0; minVal2--) cout<<minIndex2;
  21. else {
  22. cout<<1; for(;minVal>=0; minVal--) cout<<minIndex;
  23. }
  24. cout<<endl;
  25. }
  26. return 0;
  27. }
Success #stdin #stdout 0s 3344KB
stdin
6
2 1 1 4 0 6 3 2 2 2
0 1 1 1 1 1 1 1 1 1
2 2 1 2 1 1 3 1 1 1
1 2 2 2 2 2 2 2 2 2
3 3 2 3 3 2 3 3 2 2
2 3 3 3 2 3 3 3 3 2
stdout
4
10
22
100
222
444