杨家坪C++1901班的程序备份

JupHamaster 木星拜 2021-09-20 15:51:35 2021-10-30 15:37:21 0

#9.20

#include <bits/stdc++.h>

using namespace std;
int a[110] = {'0'};
int idx = -1;

//出栈 
char pop()
{
	idx--;
	return a[idx+1];
}

//压栈
void push(int x)
{
	idx++;
	a[idx] = x;
}

int main(void)
{
	int n;
	cin >> n;
	while (n!=0)
	{
		int mod = n%16;
		if(mod>=10)
			mod = 'A'+mod-10;
		else
			mod = '0'+mod;
		push(mod);
		N=N/16;
	}
	while(idx>=0)
	{
		cout<<pop();
	}
} 
a = int (input())
ls = list()
while a!=0:
    ls.append(a%2)
    a//=2
for i in range(len(ls)):
    print(ls.pop(),end='')
print("\n")

#9.25

cmath:pow平方 sqrt开方 ctime:time(NULL)当前时间

#include <bits/stdc++.h>

using namespace std;

int n;
int main(void)
{
	cin >> n;
	for(int i=100;i<=n;i++)
	{
		int num = i;
		int g = num%10; //个位
		num/=10;
		int s = num%10;//十位 
		num/=10;
		int b  =num;//百位 
		if(g*g*g+s*s*s+b*b*b == i) cout<<i<<"\n"; 
	}
	return 0;
}
#include <bits/stdc++.h>

using namespace std;

int main(void)
{
	time_t start_time = time(NULL);
	for(int i=100000000;i<100000000;i++)
	{
		int sum = 0;
		int n = i;
		while (n!=0)
		{
			int mod = n%10;
			n/=10;
			sum+=pow(mod,9);
		}
		if(i == sum) cout<<sum<<" ";	
	}
	cout<<time(NULL)-start_time;
	return 0;
}

#10.30

#include <iostream>
#include <cstdio>

using namespace std;

int main(void)
{
	int a=10;
	int arr[10] = {};
	cout<<sizeof(float)<<"\n";
	printf("%#p\n",&a);
	printf("%#p\n",&arr);
	printf("%#p\n",&arr[0]);
	return 0;
}
#include <bits/stdc++.h>

using namespace std;

int main(void)
{
	int k = 1;
	int *p = &k;
	cout<<p;
	return 0;
}
#include <bits/stdc++.h>

using namespace std;

int main(void)
{
	//part1
	int a[10] = {0};
	int *p;
	p = a;
	cout<<p;
	cout<<"\n";
	//part2
	int k = 1;
	int *p = &k;
	cout<<p;
	cout<<"\n"
	//part3
	*p1 = &k;
	cout<<++(*p)<<"\s";
	cout<<(*p)++<<"\n";
	//part4
	int a = 12;
	int *p = &a;
	cout<<p<<endl;
	cout<<p+1<<endl;
	cout<<p+2<<endl;
	cout<<p+3<<endl;
	//part5
	int *q2;
	q = &arr[9];
	for(int i=9;i>=0;i--)
	{
		cout<<*(q--)<<"\t";
	}
	return 0;
}
{{ vote && vote.total.up }}