using System;publicclassLine{publicstaticintWhereIsHe(int p,int bef,int aft){return Math.Min(aft +1, p - bef);}}
答案7:
using System;publicclassLine{/**
* @param p Total number of persons in queue.
* @param bef Number of persons who _are_ at the front of the queue.
* @param aft Number of persons who _may_ be at the back of the queue.
*
* @return The number of positions that a person may occupy between
* those that are definitely in front and those that might
* be behind.
*/publicstaticintWhereIsHe(int p,int bef ,int aft){return Math.Min(p-bef, aft+1);}}
using System;publicclassLine{publicstaticintWhereIsHe(int p,int bef ,int aft){return aft +1>= p - bef ? p - bef : aft +1;}}
答案11:
using System;publicclassLine{publicstaticintWhereIsHe(int p,int bef,int aft){return Math.Min(1+ aft, p - bef);}}
答案12:
using System;publicclassLine{publicstaticintWhereIsHe(int p,int bef,int aft ){var count =0;var before =0;var after = p -1;for(int i =1; i <= p; i++){if( before >= bef && after <= aft ){
count +=1;}
before +=1;
after -=1;}return count;}}
答案13:
using System;publicclassLine{publicstaticintWhereIsHe(int p,int before,int after){return Math.Min(1+ after, p - before);}}
答案14:
using System;publicclassLine{publicstaticintWhereIsHe(int p,int bef ,int aft){int count =0;for(int i =1; i <= p; i++)if(p - i >= bef && i -1<= aft)
count++;return count;}}
哪里是Vasya?【难度:1级】:答案1:using System;public class Line { public static int WhereIsHe(int p, int bef ,int aft) { return Math.Min(p-bef,aft+1); } }答案2:u...