10346 - Peter's Smokes.c
#include<stdio.h>
int main()
{ int n,K,i,sum,l,p;
while (scanf("%d%d",&n,&K)!=EOF)
{
int sum1=n;
for(i=0;i<n;n=sum)
{
if(n<K)
{
break;
}
l=n/K;
p=n%K;
sum=l+p;
sum1=sum1+l;
}
printf("%d\n",sum1);
}
return 0;
}
100 - The 3n + 1 problemTime limit: 3.000 seconds The 3n + 1 problem Background Problems in Computer Science are often classified as belon...
UVA-382–Perfection- Using java 382 - PerfectionTime limit: 3.000 seconds Perfection From the article Number Theory in the 1994 Microsoft Encarta: `...
136 - Ugly Numbers Ugly Numbers Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15,...
11479 - Is this the easiest problem A triangle is a geometric shape with three positive sides. However, any given three sides won't neces-sarily form...
<?php // Start the session session_start(); ?> <!DOCTYPE html> <html> <head> <link rel=...
No comments:
Post a Comment