Advertisement
JaimeRG01

Untitled

Jan 19th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void ordenar(int b,int a[]){
  6. int aux;
  7. for(int i=0;i<b;i++){
  8. for(int j=0;j<b;j++){
  9. if(a[j]>a[j+1]){
  10. aux = a[j+1];
  11. a[j+1] = a[j];
  12. a[j] = aux;
  13. }
  14. }
  15. }
  16. }
  17.  
  18. int main() {
  19.  
  20. int t,n;
  21. cin>>t;
  22. int fuerza=0;
  23.  
  24.  
  25. for(int i=0;i<t;i++){
  26. cin>>n;
  27. int fi[n];
  28. for(int j=0;j<n;j++){
  29. cin>>fi[j];
  30. }
  31.  
  32.  
  33. ordenar(n,fi);
  34. for(int x=0;x<n;x++){
  35. if(fuerza<fi[x]){
  36. continue;
  37. }else fuerza++;;
  38. }
  39. cout<<fuerza<<endl;
  40. fuerza = 0;
  41. }
  42.  
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement