Advertisement

21CSPJ普及组复赛试题 21CSPJ普及组复赛试题

阅读量:

T1 分糖果(candy)

题意:

这里是引用

法1: 暴力枚举 90pt

逐一列举L到R之间的所有情形,并从中确定最佳解决方案。

复制代码
    #include<bits/stdc++.h>
    
    using namespace std;
    
    int main(){
    	int n, L, R;
    	cin >> n >> L >> R;
    
    	int res = 0;
    	for(int i = L; i <= R; i++){
    		res = max(res, i % n);
    	}
    	cout << res << endl;
    		
    	return 0;
    }
    
    
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
    

全部评论 (0)

还没有任何评论哟~