编辑代码

#include <iostream>
using namespace std;

int test(int A, int B, int a, int b, int X)
{
    int temp;
    temp =  b - (X - A)*(b - a +1)/(B - A + 1);
    cout<< temp<<endl;
    return temp;

}

int main() {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
	cout << "Hello world!    - cpp.jsrun.net." << endl;

    test(0,49,36,40, 9);




	return 0;
}