Advertisement
icatalin

tema vacanta

Jan 9th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.20 KB | None | 0 0
  1. *********************************************************************************************************************************************************************************************** Varianta 1 ***********************************************************************************************************************************************************************************************
  2.  
  3. //Subiectul al II-lea
  4. //problema 1
  5.  
  6. #include <iostream>
  7. #include <fstream>
  8. #include <algorithm>
  9.  
  10. using namespace std;
  11.  
  12. ifstream f("date.in");
  13. ofstream g("date.out");
  14.  
  15.  
  16. int n,m,a[100][100];
  17.  
  18. void citire()
  19. {
  20.     f>>n>>m;
  21. }
  22.  
  23. int main()
  24. {
  25.     citire();
  26.     int i,j;
  27.  
  28.     for (i=1;i<=n;i++)
  29.         for (j=1;j<=m;j++)
  30.         a[i][j]=min(i,j);
  31.  
  32.    for (i=1;i<=n;i++)
  33.         {for (j=1;j<=m;j++)
  34.             g<<a[i][j]<<" ";
  35.         g<<'\n';
  36.         }
  37.  
  38.  
  39.     return 0;
  40. }
  41. //Subiectul al III-lea
  42. //problema 1
  43. #include <iostream>
  44. #include <fstream>
  45. #include <algorithm>
  46.  
  47. using namespace std;
  48.  
  49. ifstream f("date.in");
  50. ofstream g("date.out");
  51.  
  52. int n;
  53.  
  54. int main()
  55. {
  56.     cin>>n;
  57.  
  58.     int x;
  59.     while (f>>x)
  60.     {
  61.         if (x%n==0)
  62.             cout<<x<<" ";
  63.     }
  64.  
  65.     return 0;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement