562

hyl-20-09

heliotropic
zombotany

Eclipse
Noregret

1个月前
#include <bits/stdc++.h>
using namespace std;
int money=0,cost,save=0;
int main()
{
for(int i=1; i<=12; i++)
{
cin>>cost;
money+=300-cost;
if (money<0)return cout<<-i,0;
save+=money/100*100;
money%=100;
}
cout<<money+save*1.2;
return 0;
}


1个月前
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,x,a=0;
cin>>n>>x;
for (int i = 1; i <= n; i ++ )
for (int j = i;j;j/=10)
if (j % 10 == x)
a++;
cout<<a;
return 0;
}


1个月前
#include <bits/stdc++.h>
using namespace std;
int main()
{
int k,a=1,s=0,j=1;
cin>>k;
for(int i=1;i<=k; i++)
{
s+=a;
if(i==j)a++,j+=a;
}
cout<<s;
return 0;
}


1个月前
class Solution {
public:
int getSum(int n) {
int sum = n;
n > 0 && (sum += getSum(n - 1));
return sum;
}
};


1个月前
class Solution {
public:
string replaceSpaces(string &str) {
string a;
for (auto x : str)
if (x == ' ')
a += "%20";
else
a += x;
return a;
}
};


1个月前
class Solution {
public:
int Fibonacci(int n)
{
int a = 0, b = 1;
while (n -- )
{
int c = a + b;
a = b, b = c;
}
return a;
}
};


1个月前
#include <iostream>
using namespace std;
int n, m;
int ans;
void zfg(int x, int y)
{
if (x == n && y == m) ans ++ ;
else
{
if (y < m)zfg(x,y + 1);
if (x < n)zfg(x + 1,y);
}
}
int main()
{
cin>>n>>m;
zfg(0, 0);
cout<<ans<<endl;
return 0;
}


1个月前
#include <bits/stdc++.h>
using namespace std;
int n;
int ans;
void ttj(int k)
{
if (k == n)ans++;
else if (k < n)
{
ttj(k + 1);
ttj(k + 2);
}
}
int main()
{
cin>>n;
ttj(0);
cout<<ans<<endl;
return 0;
}


1个月前
#include <bits/stdc++.h>
using namespace std;
void sort(int a[], int l, int r)
{
for (int i = l; i <= r; i ++ )
for (int j = i + 1; j <= r; j ++ )
if (a[j] < a[i])
swap(a[i], a[j]);
}
int main()
{
int a[1000],n,l,r;
cin>>n>>l>>r;
for (int i = 0; i < n; i ++ )cin>>a[ia];
sort(a,l,r);
for (int i = 0; i < n; i ++ )cout<<a[i]<<' ';
return 0;
}


1个月前
#include <bits/stdc++.h>
using namespace std;
int unique(int a[], int size)
{
int c = 0;
for (int i = 0; i < size; i ++ )
{
bool flag = false;
for (int j = 0; j < i; j ++ )
if (a[j] == a[i])
{
flag = true;
break;
}
if (!flag)c ++ ;
}
return c;
}
int main()
{
int a[1000],n;
cin>>n;
for (int i = 0; i < n; i ++ )cin>>a[i];
cout<<unique(a,n)<<endl;
return 0;
}