Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int n,k;
  8. string s[10005];
  9.  
  10. int main(){
  11.     cin>>n>>k;
  12.     for(int i = 1; i <= n; i++)
  13.     {
  14.         s[i] = to_string(i);
  15.     }
  16.     sort(s+1,s+n+1);
  17.     string t = to_string(k);
  18.     for(int i = 1; i <= n; i++)
  19.     {
  20.         if(s[i]==t)
  21.         {
  22.             cout<<i;
  23.         }
  24.     }
  25.      return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement