小丁的試驗 |
Time Limit: 1 Seconds Memory Limit: 32768 K Total Submit:179 Accepted:51 |
Description Description Input 一個正整數T,表示數據的組數,接下去的T行,每一行有兩個整數,表示n和t,其中2<=n<=500000,0<=t<=100000 Output 如果正確,輸出YES,否則輸出NO Sample Input 2 4 2 10 6
Sample Output YES NO |
Source: #include<iostream.h> int main() { int n,s,m,i,j,k; cin>>m; while(m--) { cin>>n>>s; i=3;j=5;k=1; while(i<n) { i=i+j; j=j+2; k++; } if(s==n-k) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; }
|