Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.17 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10. #include<iostream>
  11. using namespace std;
  12. int main(){
  13. long long cifriNaSegNomer[10];//shte polzvam masiva naobratno
  14. //index 0 e za edinicite, 1 za deseticite
  15. long long uspeshnoNomerirani=0,obshtoZaNomerirane,il,ic;
  16. long long lipsvashti[3],kolkoOvceVzimatSegNomer,broiLipsvashti;
  17. cin>>obshtoZaNomerirane>>broiLipsvashti;
  18. lipsvashti[0]=-1;
  19. lipsvashti[1]=-1;
  20. lipsvashti[2]=-1;
  21. for(il=0;il<broiLipsvashti;il=il+1){
  22.     cin>>lipsvashti[il];
  23. }
  24. cifriNaSegNomer[0]=1;
  25. for(ic=1;ic<10;ic=ic+1){
  26.     cifriNaSegNomer[ic]=0;
  27. }
  28. while(uspeshnoNomerirani<obshtoZaNomerirane){
  29.     kolkoOvceVzimatSegNomer=1;
  30.     for(ic=0;ic<10;ic=ic+1){
  31.         if(cifriNaSegNomer[ic]==lipsvashti[0] ||
  32.            cifriNaSegNomer[ic]==lipsvashti[1] ||
  33.            cifriNaSegNomer[ic]==lipsvashti[2]){
  34.             kolkoOvceVzimatSegNomer=0;
  35.         }
  36.     }
  37.     uspeshnoNomerirani=kolkoOvceVzimatSegNomer+uspeshnoNomerirani;
  38.     cifriNaSegNomer[0]=1+cifriNaSegNomer[0];
  39.     for(ic=0;cifriNaSegNomer[ic]==10;ic=ic+1){
  40.         cifriNaSegNomer[ic]=0;
  41.         cifriNaSegNomer[ic+1]=1+cifriNaSegNomer[ic+1];
  42.     }
  43. }
  44. for(ic=0;ic<10;ic=ic+1){
  45.     cout<<cifriNaSegNomer[ic];
  46. }
  47.  
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement