diff options
author | Iru Cai <mytbk920423@gmail.com> | 2018-05-24 21:39:58 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2018-05-24 21:39:58 +0800 |
commit | 1eefd58ca4fdb5d2f51f657bfd70c9a89a4707db (patch) | |
tree | abde0e4da3c7fe138f3874a94d8eb7d0e44c3224 /euler22.c | |
download | project_euler-1eefd58ca4fdb5d2f51f657bfd70c9a89a4707db.tar.xz |
initial commit
Diffstat (limited to 'euler22.c')
-rw-r--r-- | euler22.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/euler22.c b/euler22.c new file mode 100644 index 0000000..d969fe7 --- /dev/null +++ b/euler22.c @@ -0,0 +1,17 @@ +#include <stdio.h> + +int main() +{ + char name[10]; + int i,j,score=0; + for (i=1;scanf("%s",name)!=EOF;++i){ + int worth=0; + for (j=0;name[j];++j){ + worth+=name[j]&0xbf; + } + score+=worth*i; + } + printf("%d\n",score); + return 0; +} + |