Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Code generated && tested by LizardCode for CodeFu */
- #include <limits.h>
- #include <vector>
- #include <sstream>
- #include <iostream>
- #include <algorithm>
- #include <cstring>
- #include <string>
- #include <cstdlib>
- #include <cstdio>
- #include <map>
- #include <list>
- #include <queue>
- #include <set>
- using namespace std;
- class IpAddresses
- {
- public:
- int count( string S, int K )
- {
- }
- };
- const int Test_No=0;
- int main()
- {
- IpAddresses tmp;
- int res;
- string S;
- int K;
- /***************************Test 1 ********************************/
- if(Test_No==0 || Test_No==1){
- S = "1234567";
- K = 3;
- res = tmp.count(S,K);
- if(res == 1) cout<<"test #"<<1<<" Correct!\n\n";
- else {cout<<"test #"<<1<<" Wrong!\n";
- cout<<"Expected: "<<1<<"\n";
- cout<<"Recieved: "<< res <<" \n\n";}
- cout<<"---------------------------------------------"<<"\n";
- }
- /******************************************************************/
- /***************************Test 2 ********************************/
- if(Test_No==0 || Test_No==2){
- S = "100111";
- K = 3;
- res = tmp.count(S,K);
- if(res == 3) cout<<"test #"<<2<<" Correct!\n\n";
- else {cout<<"test #"<<2<<" Wrong!\n";
- cout<<"Expected: "<<3<<"\n";
- cout<<"Recieved: "<< res <<" \n\n";}
- cout<<"---------------------------------------------"<<"\n";
- }
- /******************************************************************/
- /***************************Test 3 ********************************/
- if(Test_No==0 || Test_No==3){
- S = "345678";
- K = 2;
- res = tmp.count(S,K);
- if(res == 0) cout<<"test #"<<3<<" Correct!\n\n";
- else {cout<<"test #"<<3<<" Wrong!\n";
- cout<<"Expected: "<<0<<"\n";
- cout<<"Recieved: "<< res <<" \n\n";}
- cout<<"---------------------------------------------"<<"\n";
- }
- /******************************************************************/
- /***************************Test 4 ********************************/
- if(Test_No==0 || Test_No==4){
- S = "25525511135";
- K = 4;
- res = tmp.count(S,K);
- if(res == 2) cout<<"test #"<<4<<" Correct!\n\n";
- else {cout<<"test #"<<4<<" Wrong!\n";
- cout<<"Expected: "<<2<<"\n";
- cout<<"Recieved: "<< res <<" \n\n";}
- cout<<"---------------------------------------------"<<"\n";
- }
- /******************************************************************/
- /***************************Test 5 ********************************/
- if(Test_No==0 || Test_No==5){
- S = "0000";
- K = 4;
- res = tmp.count(S,K);
- if(res == 1) cout<<"test #"<<5<<" Correct!\n\n";
- else {cout<<"test #"<<5<<" Wrong!\n";
- cout<<"Expected: "<<1<<"\n";
- cout<<"Recieved: "<< res <<" \n\n";}
- cout<<"---------------------------------------------"<<"\n";
- }
- /******************************************************************/
- /***************************Test 6 ********************************/
- if(Test_No==0 || Test_No==6){
- S = "0000";
- K = 3;
- res = tmp.count(S,K);
- if(res == 0) cout<<"test #"<<6<<" Correct!\n\n";
- else {cout<<"test #"<<6<<" Wrong!\n";
- cout<<"Expected: "<<0<<"\n";
- cout<<"Recieved: "<< res <<" \n\n";}
- cout<<"---------------------------------------------"<<"\n";
- }
- /******************************************************************/
- /***************************Test 7 ********************************/
- if(Test_No==0 || Test_No==7){
- S = "1111111111";
- K = 10;
- res = tmp.count(S,K);
- if(res == 1) cout<<"test #"<<7<<" Correct!\n\n";
- else {cout<<"test #"<<7<<" Wrong!\n";
- cout<<"Expected: "<<1<<"\n";
- cout<<"Recieved: "<< res <<" \n\n";}
- cout<<"---------------------------------------------"<<"\n";
- }
- /******************************************************************/
- /***************************Test 8 ********************************/
- if(Test_No==0 || Test_No==8){
- S = "1111111111";
- K = 7;
- res = tmp.count(S,K);
- if(res == 77) cout<<"test #"<<8<<" Correct!\n\n";
- else {cout<<"test #"<<8<<" Wrong!\n";
- cout<<"Expected: "<<77<<"\n";
- cout<<"Recieved: "<< res <<" \n\n";}
- cout<<"---------------------------------------------"<<"\n";
- }
- /******************************************************************/
- /***************************Test 9 ********************************/
- if(Test_No==0 || Test_No==9){
- S = "1110000111";
- K = 5;
- res = tmp.count(S,K);
- if(res == 1) cout<<"test #"<<9<<" Correct!\n\n";
- else {cout<<"test #"<<9<<" Wrong!\n";
- cout<<"Expected: "<<1<<"\n";
- cout<<"Recieved: "<< res <<" \n\n";}
- cout<<"---------------------------------------------"<<"\n";
- }
- /******************************************************************/
- /***************************Test 10 ********************************/
- if(Test_No==0 || Test_No==10){
- S = "1110000111";
- K = 6;
- res = tmp.count(S,K);
- if(res == 6) cout<<"test #"<<10<<" Correct!\n\n";
- else {cout<<"test #"<<10<<" Wrong!\n";
- cout<<"Expected: "<<6<<"\n";
- cout<<"Recieved: "<< res <<" \n\n";}
- cout<<"---------------------------------------------"<<"\n";
- }
- /******************************************************************/
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement