The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled C++ Code
Posted by: ankur | October 10, 2009 @ 7:01am
C++ Code
[
Download
]
#include<iostream> #include<string> #include<vector> #include<stdlib.h> #include<string.h> #include<math.h> #include<limits.h> #include<algorithm> using namespace std; int contno(int num,int k); int strnum(string str); int main() { int n,m,t,k=1,i=0,i1,j,p; string str; cin>>t; for(int l=0;l<=t;l++) { i=0; m=0; getline(cin,str,'\n'); i1=str.length(); k=str[i1-1]-48; n=strnum(str); while(m<=n) { i++; if(contno(i,k)) m++; } if(l!=0) cout<<i-1<<"\n"; } cin.get(); return 0; } int strnum(string str) {int k=0,l=1; int i=str.length()-3; while(i>=0) { k=k+l*(str[i]-48); l=l*10; i--; } return k; } int contno(int num,int k) { int num2=num,tok=0; while(num2>0) { if(num2%10==k) {tok=1; break; } else num2=num2/10; } if(tok==1) return 0; else return 1; }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.40 / 8
78 Votes
http://codebin.yi.org/403
page generated in 0.00 seconds