btc001

183

LZX123

sth超

btc001
8天前
#include <iostream>
using namespace std;
int main()
{
int n,ans;
cin >> n;
for(int i = 1; i<= n; i++)
{
ans = max(2*abs(i-1),2*abs(i-n));
cout << ans << endl;
}
return 0;
}


btc001
9天前

LL

btc001
20天前
#include <iostream>
using namespace std;
int main()
{
//法一：
/*string s;
while(cin>>s) cout <<s<<' ';//只要有字符串，就一直读。
return 0;*/
//法二：
string s;
getline(cin,s);
string r;
for(int i=0;i < s.size();i++)
{
if(s[i]!=' ')
{
r+=s[i];
}
else
{
r+=' ';
int j = i;
while(j < s.size()&&s[j]==' ')j++;
i = j-1;
}
}
cout << r << endl;
return 0;
}


btc001
20天前
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
while(cin >> n,n)
{
for(int i = 0;i<n;i++)
{
for(int j = 0;j<n;j++)
{
cout << (int)pow(2,i+j) << ' ' ;
}
cout << endl;
}
cout << endl;
}
return 0;
}


btc001
26天前
#include <iostream>
using namespace std;
int main()
{
int n,centre;
cin >> n;
centre = n/2+1;
for(int i = 1;i<=n;i++)
{

for(int j = 1;j<=n;j++)
{
if(j<1+abs(i-centre)||j>centre+centre-1-abs(i-centre))
{
cout << " " ;

}
else
{
cout << "*" ;
}

}
cout << endl;
}
return 0;
}


btc001
27天前
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
double money;
cin >> money;
double count[20] = {0,100.00,50.00,20.00,10.00,5.00,2.00,1.00,0.50,0.25,0.10,0.05,0.009};
int total[15] = {0};
for(int i = 1; i <= 12; i++)
{
while(money>=count[i])
{
money -= count[i];
total[i]++;

}
if(money == 0)
break;
}
cout << "NOTAS:"<<endl;
for(int i = 1; i<=6;i++)
{
printf("%d nota(s) de R$%.2lf\n",total[i],count[i]); } cout << "MOEDAS:"<<endl; for(int i = 7;i<=12;i++) { printf("%d moeda(s) de R$ %.2lf\n",total[i],count[i]);
}
return 0;
}