题意:求进位的姿势是什么
Rounding 表示四舍五入
Truncation 表示去除小数
算出每种的区间,若区间有交集则可能。
注意边界
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cctype>
#include <cmath>
#include <string>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
#include <queue>
#include <stack>
#include <vector>
#include <deque>
#include <set>
#include <map>
typedef long long LL;
typedef long double LD;
#define INFF 2139062143
#define INF 0x3f3f3f3f
const double PI=acos(-1.0);
const double eps=1e-5;
const LL mod=1e9+9;
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
//typedef pair<int, int> PI;
//typedef pair<int, PI> PP;
#ifdef _WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
//#pragma comment(linker, "/STACK:1024000000,1024000000")
//LL quick(LL a, LL b){LL ans=1;while(b){if(b & 1)ans*=a;a=a*a;b>>=1;}return ans;}
//inline int read(){char ch=' ';int ans=0;while(ch<'0' || ch>'9')ch=getchar();while(ch<='9' && ch>='0'){ans=ans*10+ch-'0';ch=getchar();}return ans;}
//inline void print(LL x){printf(LLD, x);puts("");}
//inline void read(int &x){char c = getchar();while(c < '0') c = getchar();x = c - '0'; c = getchar();while(c >= '0'){x = x * 10 + (c - '0'); c = getchar();}}
struct node
{
int l[2],r[2];
}pp[2222];
int main()
{
int m,p,t,n;
cin>>t;
while(t--)
{
cin>>n;
for(int i=0;i<n;i++)
{
scanf("%d%d%*c",&m,&p);
if(p==0)//右//kai
pp[i].r[0]=INF;
else
pp[i].r[0]=(int)((m*100)/(p-0.5));
if(p==100)//左//bi
pp[i].l[0]=m;
else pp[i].l[0]=(int)((m*100)/(p+0.5))+1;//
if(p==0)//bi
pp[i].r[1]=INF;
else
pp[i].r[1]=int((m*100)/p);
if(p==100)//kai
pp[i].l[1]=m;
else
pp[i].l[1]=int((m*100)/(p+1))+1;
}
int ans=0;
int l=-INF,r=INF;
for(int i=0;i<n;i++)
{
l=max(l,pp[i].l[0]);
r=min(r,pp[i].r[0]);
}
if(l<=r)
ans|=1;
l=-INF,r=INF;
for(int i=0;i<n;i++)
{
l=max(l,pp[i].l[1]);
r=min(r,pp[i].r[1]);
}
if(l<=r)
ans|=2;
if(ans==3)
puts("Either");
else if(ans==0)
puts("Neither");
else if(ans==1)
puts("Rounding");
else if(ans==2)
puts("Truncation");
}
return 0;
}