随便打的草码,不喜勿喷,算多少p,多少g,多少连击才能拿到预期分数
#include<iostream>
#include<math.h>
//using namespace std;
const double accpscore=900000,comboscore=100000,accgscore=585000;
int perfect,good,maxcombo,sumcombo,expectscore,score,answer;
int main()
{
std::cin>>sumcombo>>expectscore;
for(perfect=0;perfect<=sumcombo;perfect++){
for(good=0;good<=sumcombo-perfect;good++){
for(maxcombo=(sumcombo>>(sumcombo-perfect-good));maxcombo<=perfect+good;maxcombo++){
if(perfect+good==sumcombo)maxcombo=sumcombo;
score=round(accpscore/sumcombo*perfect+accgscore/sumcombo*good+comboscore/sumcombo*maxcombo);
//std::cout <<"score:"<<score<<" perfect combo:"<<perfect<<" good combo:"<<good<<" maxcombo:"<<maxcombo<<std::endl;
if(score==expectscore){
answer++;
std::cout <<"ans:perfect combo:"<<perfect<<" good combo:"<<good<<" maxcombo:"<<maxcombo<<std::endl;
//getchar();
}
}
}
}
std::cout << answer << std::endl;
}