求调悬关
  • 板块灌水区
  • 楼主hwc2011
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/12/10 16:40
  • 上次更新2024/12/10 16:42:36
查看原帖
求调悬关
1313003
hwc2011楼主2024/12/10 16:40

SPJ挂了,有没有大佬能找找问题
问题:

SPJ compilation failed: 

No interactive lib object present in store

SPJ:

#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv){
	registerInteraction(argc, argv);
	double n=inf.readReal(0.2,100.0);
	cout.flush();	
	int times=15,found=0,cnt50=1,cnt20=1,cnt10=2,cnt5=1;
	double weight=0.0,lst=0.0;
	while(times&&!found){
		times--;
		int a=ouf.readInt();
		double b=ouf.readReal();	
		if(a!=1&&a!=2&&a!=3&&a!=4) quitf(_wa,"Use actions that weren't mentioned");
		if((int)(b*5)!=b*5||b<0||b>100) quitf(_wa,"Use weight masses that do not appear");
		if(a==1){
			if(b!=50&&b!=20&&b!=10&&b!=5) quitf(_wa,"Use weight masses that do not appear");
			if(b==50){
				if(cnt50>0){
					cnt50--;
					weight+=50;
				}
				else{
					quitf(_wa,"Use the weight mass that has all been placed on the right plate");
				}
			}
			else if(b==20){
				if(cnt20>0){
					cnt20--;
					weight+=20;
				}
				else{
					quitf(_wa,"Use the weight mass that has all been placed on the right plate");
				}
			}
			else if(b==10){
				if(cnt10>0){
					cnt10--;
					weight+=10;
				}
				else{
					quitf(_wa,"Use the weight mass that has all been placed on the right plate");
				}
			}
			else{
				if(cnt5>0){
					cnt5--;
					weight+=5;
				}
				else{
					quitf(_wa,"Use the weight mass that has all been placed on the right plate");
				}
			}
		}
		else if(a==2){
			if(b!=50&&b!=20&&b!=10&&b!=5) quitf(_wa,"Use weight masses that do not appear");
			if(b==50){
				if(cnt50<1){
					cnt50++;
					weight-=50;
				}
				else{
					quitf(_wa,"Use weights that are not placed on the right plate");
				}
			}
			else if(b==20){
				if(cnt20<1){
					cnt20++;
					weight-=20;
				}
				else{
					quitf(_wa,"Use weights that are not placed on the right plate");
				}
			}
			else if(b==10){
				if(cnt10<2){
					cnt10++;
					weight-=10;
				}
				else{
					quitf(_wa,"Use weights that are not placed on the right plate");
				}
			}
			else{
				if(cnt5<1){
					cnt5++;
					weight-=5;
				}
				else{
					quitf(_wa,"Use weights that are not placed on the right plate");
				}
			}
		}
		else if(a==3){
			if(b<0||b>5) quitf(_wa,"Adjust the rider to the illegal scale");
			weight-=lst;
			weight+=b;
			lst=b;
		}
		else if(a==4){
			if(b!=n) quitf(_wa,"The mass of the object being measured is read incorrectly");
			quitf(_ok, "Read the mass of the object being measured with %d questions!",15-times);
		}
		if(weight<n) cout<<'L'<<'\n';
		else if(weight==n) cout<<'M'<<'\n';
		else cout<<'R';
		cout.flush();
	}
	if(!found) quitf(_wa,"Couldn't read the mass of the object being measured with 15 questions");
}
2024/12/10 16:40
加载中...