fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int m,n,s,a[ ]={0,0,0,0,0},cnt=0,c;
  7. cin>>n>>m;
  8. for(int i=0;i<n;i++){
  9. c = 0;
  10. for(int j=0;j<m;j++){
  11. if(i==a[j]){
  12. cnt++;
  13. c++;
  14. //cout<<"cnt="<<cnt<<" ";
  15. break;
  16. }
  17. }
  18. if (c==0) cout<<i<<" ";//没有这个数
  19. }
  20. if(cnt==n) cout<<n;
  21. return 0;
  22. }
Success #stdin #stdout 0.01s 5284KB
stdin
3 5
stdout
1 2