⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1628.cpp

📁 这是哈尔滨工业大学acmOJ的源代码
💻 CPP
字号:
/*  This Code is Submitted by wywcgs for Problem 1628 on 2005-03-23 at 18:01:31 */ 
#include <stdio.h>

int main()
{
    int N, guest[31];
    int i, temp, total;
    
    while(scanf("%d", &N) == 1){
        if(N == 0){
            return 0;
        }else{
            total = 0;
            temp = 0;
            for(i = 0; i < N; i++){
                scanf("%d", &guest[i]);
                total += guest[i];
            }
            if(total % 2 == 1){
                printf("No equal partitioning.\n");
            }else{
                total /= 2;
                for(i = 0; i < N; i++){
                    temp += guest[i];
                    if(temp == total){
                        printf("Sam stops at position %d and Ella stops at position %d.\n", (i+1), (i+2));
                        break;
                    }else if(temp > total){
                        printf("No equal partitioning.\n");
                        break;
                    }
                }
            }
        }
    }
    
    return 0;
} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -