Git Product home page Git Product logo

striving's People

Contributors

talnex avatar

Watchers

 avatar  avatar

striving's Issues

数字分割

using namespace std;

int main()
{
	int a,i;
	cin>>a;
	for(i = 5;i>0;i--){
		if(a/(int)pow(10.0,i-1)!=0) {
		    break;
		}
	}
	int* nums = new int[i];
    
	for(int j = i-1;j >= 0;j--){
		nums[j] = a/(int)pow(10.0,j);
		a = a%(int)pow(10.0,j);
	}
	cout<<i<<endl;
	for(int k=i-1;k>0;k--)
	cout<<nums[k]<<" ";
	cout<<nums[0]<<endl;
	for(int k=0;k<i;k++)
	cout<<nums[k];
	cout<<endl;
	return 0;
}

报数

	#include<iostream>
	#include<cmath>
	#include<string>
	#include<vector>
	#include<list>
	using namespace std;

	int main()
	{

		int n;
		cin>>n;
		list<int> num;
		for(int i = 1;i<=n;i++){
			num.push_back(i);
		}
		int j = 1;
		while(num.size()!=1){
			for(int i = 0;i<num.size();){
				if(j==3){
					list<int>::iterator it = num.begin();
					advance(it,i);
					num.erase(it);
					j=1;
				}else{
					j++;
					i++;
				}
			}
		}
		int res = num.front();
		cout<<res<<endl;
	
		return 0;
	}

最大公约数最小公倍数

#include<iostream>
#include<cmath>
#include<string>
using namespace std;
int fun(int x,int y){
	if(x%y==0) return y;
	else fun(y,x%y);
}
int main()
{
	int a,b;
	cin>>a>>b;
	int res = fun(a,b);
	cout<<res<<" "<<a*b/res<<endl;
	return 0;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.