当前位置: 首页 > news >正文

Codeforces Round 993A Easy Problem

https://codeforces.com/contest/2044/problem/A

修改地址2044就可以了。

思路很简单,每次-1

#include <iostream>
#include <string>
#include <vector>
using namespace std;int main()
{int t = 0,n=0,c1=0;cin >> t;int a = 0, b = 0;while (t--){cin >> n;c1 = 0;for (int i = n-1; i >0; i--){a = i - 1;b = n - a;c1++;}cout << c1 << endl;c1 = 0;}return 0;
}/*
Cube is given an integer N.
She wants to know how many ordered pairs of positive integers(a,b),
there are such that a=n-b.
Since Cube is not very good at math,
please help her!Input
The first line contains an integer t(1≤t≤99) — the number of test cases.The only line of each test case contains an integer n(2≤n≤100).Output
For each test case, output the number of ordered pairs (a,b)
on a new line.Example
Input
3
2
4
6
Output
1
3
5
*/

第二种方法,也是可以,都是AC

#include <iostream>
#include <string>
#include <vector>
using namespace std;int main()
{int t = 0,n=0;cin >> t;int a = 0, b = 0;while (t--){cin >> n;cout << n - 1<<endl;}return 0;
}

http://www.dtcms.com/a/430873.html

相关文章:

  • OSI模型、网络地址、与协议
  • Codeforces Round 993B. Normal Problem
  • 《嵌入式 – GD32开发实战指南(RISC-V版本)》第3章 GPIO流水灯的前世今生
  • 深圳手机网站建设哪家好表白链接生成器
  • GameObject 常见类型详解 -- 光环生成对象(AURA GENERATOR)
  • 29.CSS 3D 加载转轮 | CSS 动画效果
  • 潍坊制作网站用淘宝做公司网站
  • AMQP协议深度解析:消息队列背后的通信魔法
  • CSP-J/S复赛真实考试场景还原与备考策略
  • 攻防世界-Web-inget
  • flex布局学习记录
  • unordered_map和unordered_set的使用以及哈希表的实现
  • Powershell 管理 后台/计划 作业(六)
  • 北京网站建设公司东为企业网络营销方案策划书
  • 四川网站营销seo什么价格网站建设哪家g
  • k8s-pod的镜像升级与回滚
  • Django 从入门到进阶:构建完整的博客系统
  • XYplorer(多标签文件管理器) 多语便携版
  • 哈尔滨公告最新消息枣庄seo推广
  • 从输入网址到网页呈现:深入理解 HTTP 及其背后的网络世界
  • 建设一个网站需要什么软件抖音小程序在哪里找
  • Rust语言简介
  • 【无标题】Heartbeat高可用配置实践
  • 【LangChain】P6 对话记忆完全指南:从原理到实战(中)
  • 怎样才能把网站做好app开发制作软件
  • 石家庄网站建设外包公司工艺品网站模版
  • 【LaTeX】 5 LaTeX 文档类
  • x64dbg下载安装图文教程(附安装包)
  • pthread_create详解:打开多线程编程的大门
  • DFS 详解(C++版)