点击这里更换您喜欢的皮肤wtboj 首页
请点击这里登入noios   首页 入门 c++讲义 入门教程视频 其他页面 入门视频 站务 公告 | 题库 记录 竞测 测试 闯关 作业 排名 团队 讨论 | 换肤 | 登入 注册  
News >>   新增功能:各团队管理员可以发布本团队作业了 ()

讨论 Discussion
 
ff
#include <iostream>
using namespace std;
int n;
int cnt = 0;
int a[20];
int len = 0;
void dfs(int r, int s) {
  if (r == 0) {
    for (int i = 0; i < len; i++) {
      cout << a[i];
      if (i < len - 1) {
        cout << " ";
      }
    }
    cout << endl;
    cnt++;
    return;
  }
  for (int i = s; i <= r; i++) {
    a[len] = i;
    len++;
    dfs(r - i, i);
    len--;
  }
}
int main() {
  cin >> n;
  dfs(n, 1);
  cout << "sum=" << cnt << endl;
  return 0;
}
( 2026/4/1 17:36:32 )

#include<bits/stdc++.h>
using namespace std;
int a[105][105];
int main(){
freopen("p1729.in","r",stdin);
freopen("p1729.out","w",stdout);
int n,k=1;
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=n-i+1;j++){
a[j][i]=i;
}
}
for(int i=n;i>0;i--){
for(int j=k;j<=n;j++){
a[i][j]=k;
}
k++;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
cout<<setw(3)<<a[i][j];
}
cout<<endl;
}
fclose(stdin);
fclose(stdout);
return 0;
}
( )
#include<bits/stdc++.h>
using namespace std;
int a[105][105];
int main(){
freopen("p1729.in","r",stdin);
freopen("p1729.out","w",stdout);
int n,k=1;
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=n-i+1;j++){
a[j][i]=i;
}
}
for(int i=n;i>0;i--){
for(int j=k;j<=n;j++){
a[i][j]=k;
}
k++;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
cout<<setw(3)<<a[i][j];
}
cout<<endl;
}
fclose(stdin);
fclose(stdout);
return 0;
}
( )
ff
#include <bits/stdc++.h>
using namespace std;
int main() {
freopen("p1745.in","r",stdin);
freopen("p1745.out","w",stdout);
string s;
cin >> s;
long long max = -1;
long long c = 0;
bool r = false;
for (int i = 0; i < s.length(); i++) {
if (s[i] >= '0' && s[i] <= '9') {
c = c * 10 + (s[i] - '0');
r = true;
} else {
if (r) {
if (c > max) {
max = c;
}
c = 0;
r = false;
}
}
}
if (r) {
if (c > max) {
max = c;
}
}
cout << max;
fclose(stdin);
fclose(stdout);
return 0;
}
( )
发布讨论主题 回复讨论主题
 Copyright wtboj © 2005-2006. www.wutuobang.date Powered by wtboj 关于 联系 帮助
 wtboj Information ---- Total Users : 1370 | Online Users / Processes : 0 / 8 | Processed Time : 31 ms | Server Time : 2026/4/1 20:32:08