poj 3094 Quicksum

#include <stdio.h>
#include <string.h>
char word[301];
int main()
{
    int sum = 0;
    int i,len;
    while(gets(word))
    {
        sum = 0;
        if(word[0] == ‘#‘)
            break;
        len = strlen(word);
        for(i = 0; i < len; ++i)
        {
            if(word[i] != ‘ ‘)
                sum += (i+1) * (word[i]-‘A‘+1);
        }
        printf("%d\n",sum);
    }
    return 0;
}
时间: 2024-10-29 19:08:24

poj 3094 Quicksum的相关文章

POJ 3094 Quicksum 难度:0

http://poj.org/problem?id=3094 1 #include<iostream> 2 #include <string> 3 using namespace std; 4 int main() 5 { 6 string str; 7 getline(cin,str); 8 while(str != "#") 9 { 10 int ans = 0; 11 for(int i = 0;i < str.length(); i++) 12 {

POJ - 3094 - Quicksum = 水题

http://poj.org/problem?id=3094 学习fgets的使用,注意fgets是会连换行一起保存的. #include<algorithm> #include<cmath> #include<cstdio> #include<cstring> #include<iostream> #include<map> #include<set> #include<stack> #include<

POJ 3094 Quicksum(简单题)

[题意简述]:题意很简单.看例子就能理解 [分析]:略.字符串的读取操作. // 200K 0Ms #include<iostream> using namespace std; int main() { char a[256]; while(1) { int sum = 0; gets(a); if(strcmp(a,"#")==0) break; int len = strlen(a); for(int i = 0;i<len;i++) { if(a[i] ==

POJ 3094 Quicksum(简单的问题)

[简要题意]:题意是非常easy. 看样能理解 [分析]:略. 读取字符串. // 200K 0Ms #include<iostream> using namespace std; int main() { char a[256]; while(1) { int sum = 0; gets(a); if(strcmp(a,"#")==0) break; int len = strlen(a); for(int i = 0;i<len;i++) { if(a[i] ==

[容斥原理] poj 3094 Sky Code

题目链接: http://poj.org/problem?id=3904 Sky Code Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1334   Accepted: 405 Description Stancu likes space travels but he is a poor software developer and will never be able to buy his own spacecraf

POJ 3094

Quicksum Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 14812   Accepted: 10322 Description A checksum is an algorithm that scans a packet of data and returns a single number. The idea is that if the packet is changed, the checksum will

POJ百道水题列表

以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight Moves1101 Gamblers1204 Additive equations 1221 Risk1230 Legendary Pokemon1249 Pushing Boxes 1364 Machine Schedule1368 BOAT1406 Jungle Roads1411 Annive

POJ题目分类推荐 (很好很有层次感)

著名题单,最初来源不详.直接来源:http://blog.csdn.net/a1dark/article/details/11714009 OJ上的一些水题(可用来练手和增加自信) (POJ 3299,POJ 2159,POJ 2739,POJ 1083,POJ 2262,POJ 1503,POJ 3006,POJ 2255,POJ 3094) 初期: 一.基本算法: 枚举. (POJ 1753,POJ 2965) 贪心(POJ 1328,POJ 2109,POJ 2586) 递归和分治法. 递

POJ 刷题指南

OJ上的一些水题(可用来练手和增加自信) (POJ 3299,POJ 2159,POJ 2739,POJ 1083,POJ 2262,POJ 1503,POJ 3006,POJ 2255,POJ 3094) 初期: 一.基本算法: 枚举. (POJ 1753,POJ 2965) 贪心(POJ 1328,POJ 2109,POJ 2586) 递归和分治法. 递推. 构造法.(POJ 3295) 模拟法.(POJ 1068,POJ 2632,POJ 1573,POJ 2993,POJ 2996) 二