2.7打卡
2.7打卡
1020 月饼
#include<iostream>
#include<iomanip>
#include<algorithm>
using namespace std;
struct Yuebing{
double kucun;
double price;
};
bool cmp_average(const Yuebing &x, const Yuebing &y) {
return (x.price / x.kucun) > (y.price / y.kucun);
}
int main()
{
int N;
double D;
cin>>N>>D;
struct Yuebing y1[N];
for(int i=0;i<N;i++)
{
cin>>y1[i].kucun;
}
for(int i=0;i<N;i++)
{
cin>>y1[i].price;
}
sort(y1,y1+N,cmp_average);
double shouchu=0;
double shouyi=0;
int j=0;
while(shouchu<D&&j<=(N-1))
{
if(y1[j].kucun<=(D-shouchu))
{
shouchu+=y1[j].kucun;
shouyi+=y1[j].price;
j++;
}
else if(y1[j].kucun>(D-shouchu))
{
double temp=y1[j].kucun/(D-shouchu);
shouyi+=y1[j].price/temp;
break;
}
}
cout<<setprecision(2)<<fixed<<shouyi<<endl;
system("pause");
return 0;
}
1021 个位数统计
#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;
int main()
{
string s;
cin>>s;
set<char> s1;
map<char,int> m1;
for(int i=0;i<s.size();i++)
{
if(s1.count(s[i])==0)
{
m1[s[i]]=1;
s1.insert(s[i]);
}
else
{
m1[s[i]]+=1;
}
}
map<char,int>::iterator it;
for(it=m1.begin();it!=m1.end();it++)
{
cout<<it->first<<":"<<it->second<<endl;
}
system("pause");
return 0;
}
1022 D进制的A+B
#include<iostream>
#include<vector>
using namespace std;
int main()
{
int A,B,C;
cin>>A>>B>>C;
int sum=A+B;
vector<int> v1;
if(sum==0)
{
cout<<"0"<<endl;
}
while(sum!=0)
{
int temp=sum%C;
v1.push_back(temp);
sum=sum/C;
}
for(int i=v1.size()-1;i!=-1;i--)
{
cout<<v1[i];
}
system("pause");
return 0;
}
1023 组个最小数
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int a;
vector<int> v0;
vector<int> v1;
for(int i=0;i<10;i++)
{
int n;
cin>>n;
v0.push_back(n);
}
for(int i=0;i<10;i++)
{
for(int j=0;j<v0[i];j++)
{
v1.push_back(i);
}
}
int temp=0;
int time=-1;
if(v1[0]==0)
{
temp=1;
}
for(int i=0;i<v1.size();i++)
{
if(temp==1&&v1[i]==0)
{
time+=1;
}
else if(temp==1&&v1[i]!=0)
{
cout<<v1[i];
time+=1;
temp=0;
i=-1;
}
else if(temp==0)
{
if(i==time)
{
continue;
}
cout<<v1[i];
}
}
system("pause");
return 0;
}
1024 科学计数法
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
string s;
cin>>s;
int pos=0;
int start=1;
if(s[0]=='-')
{
cout<<"-";
}
pos=s.find("E",start);
string s1(s,start,pos-start);
start=pos+1;
string fuhao(s,start,1);
start+=1;
string s2;
for(int i=start;i<s.size();i++)
{
s2+=s[i];
}
if(fuhao=="+")
{
int weishu=stoi(s2);
int j=weishu+2-s1.size();
if(j>=0)
{
for(int i=0;i<s1.size();i++)
{
if(i==1)
{
continue;
}
cout<<s1[i];
}
for(int i=0;i<j;i++)
{
cout<<"0";
}
}
else if(j<0)
{
for(int i=0;i<s1.size();i++)
{
if(i==1)
{
continue;
}
cout<<s1[i];
if(i==weishu+1)
{
cout<<".";
}
}
}
}
if(fuhao=="-")
{
int weishu=stoi(s2);
if(weishu==0)
{
cout<<s1;
}
else
{
s1.replace(1,1,"");
cout<<"0.";
for(int i=1;i<weishu;i++)
{
cout<<"0";
}
cout<<s1;
}
}
system("pause");
return 0;
}
...全文
相关推荐
安卓 钉钉定位打卡,安卓 钉钉定位打卡,安卓 钉钉定位打卡
安卓 钉钉定位打卡
H5 网抑云早起打卡源码 熬夜打卡源码 可对接公众号+免签支付
安装说明 测试环境:NGINX-1.18.0 PHP-5.6 MySQL-5.5 数据库配置:Application/Common/Conf/config.php NGINX伪静态: location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1 last; break; } } 支付配置:Public/ptpaysdk/core/ptpay_config.php 后台地址:/admin 后台账号:admin 后台密码:admin
Python-钉钉自动上下班打卡辅助基于Pythonadb实现打卡后自动发送邮件提醒
钉钉自动上下班打卡辅助,基于Python,adb,实现,打卡后自动发送邮件提醒。
新浪自动打卡程序2.0-此版本暂停,请下新版
新浪打卡全新改版,自动打卡程序也全新改版,适应新浪打卡的需求
阅读器打卡、手机打卡脚本
1.阅读器打卡、手机打卡脚本 2.一键操作,自动打卡,省时省力,打了很多次卡了,没有翻车 3.python脚本 4.一键操作 5.打卡完成自动关闭 6.特别方便,傻瓜式操作


