nyoj 216

news/2024/11/7 5:29:36/
描述
When Teddy was a child , he was always thinking about some simple math problems ,such as “What it’s 1 cup of water plus 1 pile of dough ..” , “100 yuan buy 100 pig” .etc..
One day Teddy met a old man in his dream , in that dream the man whose name was“RuLai” gave Teddy a problem :
Given an N , can you calculate how many ways to write N as i * j + i + j (0 < i <= j) ?
Teddy found the answer when N was less than 10…but if N get bigger , he found it was too difficult for him to solve.
Well , you clever ACMers ,could you help little Teddy to solve this problem and let him have a good dream ?
输入
The first line contain a T(T <= 2000) . followed by T lines ,each line contain an integer N (0<=N <= 10^11).
输出
For each case, output the number of ways in one line
样例输入
2
1
3
样例输出
0

1


#include<stdio.h>
#include<math.h>
int main()
{int t,n;scanf("%d",&t);while(t--){scanf("%d",&n);int sum=0;int t=sqrt(n+1);for(int i=2;i<=t;i++)if((n+1)%i==0) sum++;printf("%d\n",sum);}return 0;
}



http://www.ppmy.cn/news/206503.html

相关文章

Nyoj 269

首先题目读的费劲&#xff01;另外不能在for循环中定义变量i,j之类的&#xff0c;否则会超时&#xff01;&#xff01;&#xff01; dp[i][j] dp[i-1][j-k], i > 2&#xff0c;j < 9*i && k < j && k < 9; #include <iostream> #include …

163和169网的关系?

什么是163网和169网&#xff1f;二者之间有什么关系呢&#xff1f;很多人对此还存在着模糊的认识。163网即中国公用计算机互联网(CHINANET)&#xff0c;该网络由邮电部建设经营&#xff0c;是我国四大计算机互联网之一&#xff0c;是Internet在中国的接入部分。其用户特服接入号…

nyoj-1162-数字

数字 时间限制&#xff1a; 1000 ms | 内存限制&#xff1a; 65535 KB 难度&#xff1a; 0 描述 有一行数字 ,现在定义 0表示空格&#xff0c;即这行数字被分割成若干个数 要求将这些数按照从小到大顺序排列&#xff0c;若该行数字全为零 则表示为零&#xff0c;两个数字之间…

nyoj 136

题意&#xff1a; 描述 有以下等式&#xff1a;a1*x13a2*x23a3*x33a4*x43a5*x530 x1,x2,x3,x4,x5都就在区间[-50,50]之间的整数&#xff0c;且x1,x2,x3,x4,x5都不等于0. 问&#xff1a;给定a1,a2,a3,a4,a5的情况下&#xff0c;x1,x2,x3,x4,x5共有多少种可能的取值&#xff1f; …

ZZNU2141: 2333

题目链接 2141: 2333 时间限制: 1 Sec 内存限制: 128 MB 提交: 119 解决: 34 [提交] [状态] [讨论版] [命题人:admin] 题目描述 “别人总说我瓜&#xff0c;其实我一点也不瓜&#xff0c;大多数时候我都机智的一批“ 宝儿姐考察你一道很简单的题目。给你一个数字串&#x…

nyoj216

A problem is easy时间限制&#xff1a;1000 ms | 内存限制&#xff1a;65535 KB难度&#xff1a;3描述When Teddy was a child , he was always thinking about some simple math problems ,such as “What it’s 1 cup of water plus 1 pile of dough ..” , “100 yuan bu…

NYOJ116

NYOJ116 注意数组大小 #include <stdio.h> #include <math.h> #include <string.h> typedef struct STU{int grade;//不管是求区间最大值&#xff0c;还是次数&#xff0c;修改的都是grade&#xff0c;也就是grade的求法不同&#xff0c;比如这里是每一个节…