delete pics to save space

This commit is contained in:
2023-08-03 09:22:52 +08:00
commit de60cd6ed4
1334 changed files with 66221 additions and 0 deletions

View File

@ -0,0 +1,13 @@
#include<iostream>
using namespace std;
int main()
{
char sr;
int add;
while(true)
{
add=0;
while((sr=getchar())!='\n') add+=sr-'0';
cout<<add<<endl;
}
}

View File

@ -0,0 +1,21 @@
#include<iostream>
#include<vector>
using namespace std;
long long zk(int sr)
{
if(sr==2) return 2;
if(sr==1) return 1;
return zk(sr-1)*2+zk(sr-2);
}
int main()
{
vector <int> sr;
int n;
while(true)
{
cin>>n;
sr.resize(n);
for(int i=0;i<n;i++) cin>>sr[i];
for(int i=0;i<n;i++) cout<<zk(sr[i])<<endl;
}
}

View File

@ -0,0 +1,40 @@
#include<iostream>
using namespace std;
long double f_j(int sr)
{
if(sr<0) return 0;
if(sr==0) return 1;
return sr*f_j(sr-1);
}
long double C(int x,int y)
{
return f_j(x)/f_j(x-y)/f_j(y);
}
long double big_(long double a,long double b)
{
return (a>b)?a:b;
}
long double small_(long double a,long double b)
{
return (a<b)?a:b;
}
int main()
{
int n,add;
while(true)
{
cin>>n;
add=0;
for(int one=0;one<=n;one++)
{
for(int two=0;two<=n/2;two++)
{
if(one+two*2==n)
{
add+=C(big_(one,two)+small_(one,two),small_(one,two));
}
}
}
cout<<add<<endl;
}
}

View File

@ -0,0 +1,22 @@
#include<cstdio>
using namespace std;
int answer(int a,int b,int x)
{
if(b==1) return 1;
int ans=0;
for(int i=x;i*b<=a;i++) ans+=answer(a-i,b-1,i);
return ans;
}
int main()
{
int t;
scanf("%d",&t);
int a,b,ans[t];
for(int i=0;i<t;i++)
{
scanf("%d%d",&a,&b);
ans[i]=answer(a,b,0);
}
for(int i=0;i<t;i++) printf("%d\n",ans[i]);
return 0;
}

View File

@ -0,0 +1,35 @@
#include<iostream>
#include<cmath>
using namespace std;
int log2(int y)
{
return log(y)/log(2);
}
void wrote(int sr)
{
bool f=0;
for(int i=log2(sr);sr>0;i--)
{
if(sr>=pow(2,i))
{
if(f) cout<<"+";
f=1;
cout<<"2(";
switch(i)
{
case 1:cout<<"2(0)";break;
case 2:cout<<"2";break;
default:wrote(i);
}
cout<<")";
sr-=pow(2,i);
}
}
}
int main()
{
int n;
cin>>n;
wrote(n);
return 0;
}