// UVa 10170 - The Hotel with Infinite Rooms package main import ( "fmt" "os" ) func main() { in, _ := os.Open("10170.in") defer in.Close() out, _ := os.Create("10170.out") defer out.Close() var s, d int for { if _, err := fmt.Fscanf(in, "%d%d", &s, &d)...
#include <cstdlib> using namespace std; long long sum(long long s, long long n) { return (n-s+1LL)*(n+s)/2LL; } long long bs(int S, long long D) { long long mid,l = 1LL,r = 100000000LL; while (l < r) { mid = l+(r-l)/2LL; if (sum(S, mid) >= D) r =...
说明:(⊙_⊙)。 #include<iostream>#include<cstdlib>usingnamespacestd;longlongsum(longlongs,longlongn){return(n-s+1LL)*(n+s)/2LL;}longlongbs(intS,longlongD){longlongmid,l=1LL,r=100000000LL;while(l<r){mid=l+(r-l)/2LL;if(sum(S,mid)>=D)r=mid;elsel=mid+1LL;}returnr;}in...